mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-08-09 18:22:43 -06:00
7 lines
246 KiB
JavaScript
7 lines
246 KiB
JavaScript
/**
|
||
* simplemde v1.11.2
|
||
* Copyright Next Step Webs, Inc.
|
||
* @link https://github.com/NextStepWebs/simplemde-markdown-editor
|
||
* @license MIT
|
||
*/
|
||
!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SimpleMDE=e()}(function(){return function i(r,o,l){function a(t,e){if(!o[t]){if(!r[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(s)return s(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}n=o[t]={exports:{}},r[t][0].call(n.exports,function(e){return a(r[t][1][e]||e)},n,n.exports,i,r,o,l)}return o[t].exports}for(var s="function"==typeof require&&require,e=0;e<l.length;e++)a(l[e]);return a}({1:[function(e,t,n){},{}],2:[function(e,t,n){"use strict";var l=e("typo-js");function a(o){"function"!=typeof(o=o||{}).codeMirrorInstance||"function"!=typeof o.codeMirrorInstance.defineMode?console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`"):(String.prototype.includes||(String.prototype.includes=function(){return-1!==String.prototype.indexOf.apply(this,arguments)}),o.codeMirrorInstance.defineMode("spell-checker",function(e){a.aff_loading||(a.aff_loading=!0,(t=new XMLHttpRequest).open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),t.onload=function(){4===t.readyState&&200===t.status&&(a.aff_data=t.responseText,a.num_loaded++,2==a.num_loaded)&&(a.typo=new l("en_US",a.aff_data,a.dic_data,{platform:"any"}))},t.send(null)),a.dic_loading||(a.dic_loading=!0,(n=new XMLHttpRequest).open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),n.onload=function(){4===n.readyState&&200===n.status&&(a.dic_data=n.responseText,a.num_loaded++,2==a.num_loaded)&&(a.typo=new l("en_US",a.aff_data,a.dic_data,{platform:"any"}))},n.send(null));var t,n,i='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',r={token:function(e){var t=e.peek(),n="";if(i.includes(t))return e.next(),null;for(;null!=(t=e.peek())&&!i.includes(t);)n+=t,e.next();return a.typo&&!a.typo.check(n)?"spell-error":null}},e=o.codeMirrorInstance.getMode(e,e.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(e,r,!0)}))}a.num_loaded=0,a.aff_loading=!1,a.dic_loading=!1,a.aff_data="",a.dic_data="",t.exports=a},{"typo-js":13}],3:[function(e,t,n){(function(i){"use strict";i.defineOption("fullScreen",!1,function(e,t,n){!(n=n==i.Init?!1:n)!=!t&&(t?(t=(n=e).getWrapperElement(),n.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:t.style.width,height:t.style.height},t.style.width="",t.style.height="auto",t.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",n):((n=(t=e).getWrapperElement()).className=n.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="",e=t.state.fullScreenRestore,n.style.width=e.width,n.style.height=e.height,window.scrollTo(e.scrollLeft,e.scrollTop),t)).refresh()})})("object"==typeof n&&"object"==typeof t?e("../../lib/codemirror"):CodeMirror)},{"../../lib/codemirror":8}],4:[function(e,t,n){(function(i){function r(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function o(e){r(e);var t=e.state.placeholder=document.createElement("pre"),n=(t.style.cssText="height: 0; overflow: visible",t.style.direction=e.getOption("direction"),t.className="CodeMirror-placeholder CodeMirror-line-like",e.getOption("placeholder"));"string"==typeof n&&(n=document.createTextNode(n)),t.appendChild(n),e.display.lineSpace.insertBefore(t,e.display.lineSpace.firstChild)}function l(e){s(e)&&o(e)}function a(e){var t=e.getWrapperElement(),n=s(e);t.className=t.className.replace(" CodeMirror-empty","")+(n?" CodeMirror-empty":""),(n?o:r)(e)}function s(e){return 1===e.lineCount()&&""===e.getLine(0)}i.defineOption("placeholder","",function(e,t,n){var n=n&&n!=i.Init;t&&!n?(e.on("blur",l),e.on("change",a),e.on("swapDoc",a),i.on(e.getInputField(),"compositionupdate",e.state.placeholderCompose=function(){var n;n=e,setTimeout(function(){var e,t=!1;((t=1==n.lineCount()?"TEXTAREA"==(e=n.getInputField()).nodeName?!n.getLine(0).length:!/[^\u200b]/.test(e.querySelector(".CodeMirror-line").textContent):t)?o:r)(n)},20)}),a(e)):!t&&n&&(e.off("blur",l),e.off("change",a),e.off("swapDoc",a),i.off(e.getInputField(),"compositionupdate",e.state.placeholderCompose),r(e),(n=e.getWrapperElement()).className=n.className.replace(" CodeMirror-empty","")),t&&!e.hasFocus()&&l(e)})})("object"==typeof n&&"object"==typeof t?e("../../lib/codemirror"):CodeMirror)},{"../../lib/codemirror":8}],5:[function(e,t,n){(function(u){"use strict";var p=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,d=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,h=/[*+-]\s/;u.commands.newlineAndIndentContinueMarkdownList=function(e){if(e.getOption("disableInput"))return u.Pass;for(var t=e.listSelections(),n=[],i=0;i<t.length;i++){var r=t[i].head,o=e.getStateAfter(r.line),l=u.innerMode(e.getMode(),o);if("markdown"!==l.mode.name&&"markdown"!==l.mode.helperType)return void e.execCommand("newlineAndIndent");var l=!1!==(o=l.state).list,o=0!==o.quote,a=e.getLine(r.line),s=p.exec(a),c=/^\s*$/.test(a.slice(0,r.ch));if(!t[i].empty()||!l&&!o||!s||c)return void e.execCommand("newlineAndIndent");d.test(a)?(l=o&&/>\s*$/.test(a),c=!/>\s*$/.test(a),(l||c)&&e.replaceRange("",{line:r.line,ch:0},{line:r.line,ch:r.ch+1}),n[i]="\n"):(o=s[1],a=s[5],c=(l=!(h.test(s[2])||0<=s[2].indexOf(">")))?parseInt(s[3],10)+1+s[4]:s[2].replace("x"," "),n[i]="\n"+o+c+a,l&&function(e,t){var n=t.line,i=0,r=0,o=p.exec(e.getLine(n)),l=o[1];do{var a=n+(i+=1),s=e.getLine(a),c=p.exec(s);if(c){var u=c[1],d=parseInt(o[3],10)+i-r,h=parseInt(c[3],10),f=h;if(l!==u||isNaN(h)){if(l.length>u.length)return;if(l.length<u.length&&1===i)return;r+=1}else d===h&&(f=h+1),h<d&&(f=1+d),e.replaceRange(s.replace(p,u+f+c[4]+c[5]),{line:a,ch:0},{line:a,ch:s.length})}}while(c)}(e,r))}e.replaceSelections(n)}})("object"==typeof n&&"object"==typeof t?e("../../lib/codemirror"):CodeMirror)},{"../../lib/codemirror":8}],6:[function(e,t,n){(function(t){"use strict";t.overlayMode=function(i,r,o){return{startState:function(){return{base:t.startState(i),overlay:t.startState(r),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(e){return{base:t.copyState(i,e.base),overlay:t.copyState(r,e.overlay),basePos:e.basePos,baseCur:null,overlayPos:e.overlayPos,overlayCur:null}},token:function(e,t){return(e!=t.streamSeen||Math.min(t.basePos,t.overlayPos)<e.start)&&(t.streamSeen=e,t.basePos=t.overlayPos=e.start),e.start==t.basePos&&(t.baseCur=i.token(e,t.base),t.basePos=e.pos),e.start==t.overlayPos&&(e.pos=e.start,t.overlayCur=r.token(e,t.overlay),t.overlayPos=e.pos),e.pos=Math.min(t.basePos,t.overlayPos),null==t.overlayCur?t.baseCur:null!=t.baseCur&&t.overlay.combineTokens||o&&null==t.overlay.combineTokens?t.baseCur+" "+t.overlayCur:t.overlayCur},indent:i.indent&&function(e,t,n){return i.indent(e.base,t,n)},electricChars:i.electricChars,innerMode:function(e){return{state:e.base,mode:i}},blankLine:function(e){var t,n;return i.blankLine&&(t=i.blankLine(e.base)),null==(n=r.blankLine?r.blankLine(e.overlay):n)?t:o&&null!=t?t+" "+n:n}}}})("object"==typeof n&&"object"==typeof t?e("../../lib/codemirror"):CodeMirror)},{"../../lib/codemirror":8}],7:[function(e,t,n){(function(i){"use strict";function r(l){l.state.markedSelection&&l.operation(function(){var e=l;if(e.somethingSelected())if(1<e.listSelections().length)c(e);else{var t=e.getCursor("start"),n=e.getCursor("end"),i=e.state.markedSelection;if(i.length){var r=i[0].find(),o=i[i.length-1].find();if(!r||!o||n.line-t.line<=d||0<=f(t,o.to)||f(n,r.from)<=0)c(e);else{for(;0<f(t,r.from);)i.shift().clear(),r=i[0].find();for(f(t,r.from)<0&&(r.to.line-t.line<d?(i.shift().clear(),a(e,t,r.to,0)):a(e,t,r.from,0));f(n,o.to)<0;)i.pop().clear(),o=i[i.length-1].find();0<f(n,o.to)&&(n.line-o.from.line<d?(i.pop().clear(),a(e,o.from,n)):a(e,o.to,n))}}else a(e,t,n)}else s(e)})}function o(e){e.state.markedSelection&&e.state.markedSelection.length&&e.operation(function(){s(e)})}i.defineOption("styleSelectedText",!1,function(e,t,n){n=n&&n!=i.Init;t&&!n?(e.state.markedSelection=[],e.state.markedSelectionStyle="string"==typeof t?t:"CodeMirror-selectedtext",c(e),e.on("cursorActivity",r),e.on("change",o)):!t&&n&&(e.off("cursorActivity",r),e.off("change",o),s(e),e.state.markedSelection=e.state.markedSelectionStyle=null)});var d=8,h=i.Pos,f=i.cmpPos;function a(e,t,n,i){if(0!=f(t,n))for(var r=e.state.markedSelection,o=e.state.markedSelectionStyle,l=t.line;;){var a=l==t.line?t:h(l,0),s=l+d,c=s>=n.line,u=c?n:h(s,0),a=e.markText(a,u,{className:o});if(null==i?r.push(a):r.splice(i++,0,a),c)break;l=s}}function s(e){for(var t=e.state.markedSelection,n=0;n<t.length;++n)t[n].clear();t.length=0}function c(e){s(e);for(var t=e.listSelections(),n=0;n<t.length;n++)a(e,t[n].from(),t[n].to())}})("object"==typeof n&&"object"==typeof t?e("../../lib/codemirror"):CodeMirror)},{"../../lib/codemirror":8}],8:[function(e,t,n){var i,r;i=this,r=function(){"use strict";var e=navigator.userAgent,a=navigator.platform,g=/gecko\/\d/i.test(e),t=/MSIE \d/.test(e),s=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),c=/Edge\/(\d+)/.exec(e),b=t||s||c,v=b&&(t?document.documentMode||6:+(c||s)[1]),w=!c&&/WebKit\//.test(e),t=w&&/Qt\/\d+\.\d+/.test(e),q=!c&&/Chrome\/(\d+)/.exec(e),_=q&&+q[1],U=/Opera\//.test(e),G=/Apple Computer/.test(navigator.vendor),u=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),V=/PhantomJS/.test(e),h=G&&(/Mobile\/\w+/.test(e)||2<navigator.maxTouchPoints),$=/Android/.test(e),X=h||$||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),C=h||/Mac/.test(a),K=/\bCrOS\b/.test(e),s=/win/i.test(a),c=U&&e.match(/Version\/(\d*\.\d*)/),Y=((c=c&&Number(c[1]))&&15<=c&&(w=!(U=!1)),C&&(t||U&&(null==c||c<12.11))),Z=g||b&&9<=v;function Q(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var J=function(e,t){var n,i=e.className,t=Q(t).exec(i);t&&(n=i.slice(t.index+t[0].length),e.className=i.slice(0,t.index)+(n?t[1]+n:""))};function ee(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function y(e,t){return ee(e).appendChild(t)}function M(e,t,n,i){var r=document.createElement(e);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof t)r.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)r.appendChild(t[o]);return r}function te(e,t,n,i){e=M(e,t,n,i);return e.setAttribute("role","presentation"),e}function ne(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if((t=11==t.nodeType?t.host:t)==e)return!0}while(t=t.parentNode)}function N(e){var t,n=e.ownerDocument||e;try{t=e.activeElement}catch(e){t=n.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function ie(e,t){var n=e.className;Q(t).test(n)||(e.className+=(n?" ":"")+t)}function re(e,t){for(var n=e.split(" "),i=0;i<n.length;i++)n[i]&&!Q(n[i]).test(t)&&(t+=" "+n[i]);return t}var oe=document.createRange?function(e,t,n,i){var r=document.createRange();return r.setEnd(i||e,n),r.setStart(e,t),r}:function(e,t,n){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(e){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",t),i},le=function(e){e.select()};function ae(e){return e.display.wrapper.ownerDocument}function se(e){return ce(e.display.wrapper)}function ce(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function ue(e){return ae(e).defaultView}function de(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function he(e,t,n){for(var i in t=t||{},e)!e.hasOwnProperty(i)||!1===n&&t.hasOwnProperty(i)||(t[i]=e[i]);return t}function fe(e,t,n,i,r){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=i||0,l=r||0;;){var a=e.indexOf("\t",o);if(a<0||t<=a)return l+(t-o);l=(l+=a-o)+(n-l%n),o=a+1}}h?le=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:b&&(le=function(e){try{e.select()}catch(e){}});function pe(){this.id=null,this.f=null,this.time=0,this.handler=de(this.onTimeout,this)}function k(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}pe.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)};var me=50,ge={toString:function(){return"CodeMirror.Pass"}},ve={scroll:!(pe.prototype.set=function(e,t){this.f=t;t=+new Date+e;(!this.id||t<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=t)})},ye={origin:"*mouse"},xe={origin:"+move"};function be(e,t,n){for(var i=0,r=0;;){var o=e.indexOf("\t",i),l=(o=-1==o?e.length:o)-i;if(o==e.length||t<=r+l)return i+Math.min(l,t-r);if(r+=o-i,i=o+1,t<=(r+=n-r%n))return i}}var we=[""];function Ce(e){for(;we.length<=e;)we.push(R(we)+" ");return we[e]}function R(e){return e[e.length-1]}function ke(e,t){for(var n=[],i=0;i<e.length;i++)n[i]=t(e[i],i);return n}function Se(){}function Le(e,t){e=Object.create?Object.create(e):(Se.prototype=e,new Se);return t&&he(t,e),e}var Te=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Me(e){return/\w/.test(e)||""<e&&(e.toUpperCase()!=e.toLowerCase()||Te.test(e))}function Ne(e,t){return t?!!(-1<t.source.indexOf("\\w")&&Me(e))||t.test(e):Me(e)}function De(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return;return 1}var Ae=/[\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 Fe(e){return 768<=e.charCodeAt(0)&&Ae.test(e)}function Ee(e,t,n){for(;(n<0?0<t:t<e.length)&&Fe(e.charAt(t));)t+=n;return t}function Oe(e,t,n){for(var i=n<t?-1:1;;){if(t==n)return t;var r=(t+n)/2,r=i<0?Math.ceil(r):Math.floor(r);if(r==t)return e(r)?t:n;e(r)?n=r:t=r+i}}var He=null;function Ie(e,t,n){var i;He=null;for(var r=0;r<e.length;++r){var o=e[r];if(o.from<t&&o.to>t)return r;o.to==t&&(o.from!=o.to&&"before"==n?i=r:He=r),o.from==t&&(o.from!=o.to&&"before"!=n?i=r:He=r)}return null!=i?i:He}We=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,Pe=/[stwN]/,Re=/[LRr]/,Be=/[Lb1n]/,ze=/[1n]/;var We,Pe,Re,Be,ze,je=function(e,t){var n="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!We.test(e))return!1;for(var i,r=e.length,o=[],l=0;l<r;++l)o.push((i=e.charCodeAt(l))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(i):1424<=i&&i<=1524?"R":1536<=i&&i<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(i-1536):1774<=i&&i<=2220?"r":8192<=i&&i<=8203?"w":8204==i?"b":"L");for(var a=0,s=n;a<r;++a){var c=o[a];"m"==c?o[a]=s:s=c}for(var u=0,d=n;u<r;++u){var h=o[u];"1"==h&&"r"==d?o[u]="n":Re.test(h)&&"r"==(d=h)&&(o[u]="R")}for(var f=1,p=o[0];f<r-1;++f){var m=o[f];"+"==m&&"1"==p&&"1"==o[f+1]?o[f]="1":","!=m||p!=o[f+1]||"1"!=p&&"n"!=p||(o[f]=p),p=m}for(var g=0;g<r;++g){var v=o[g];if(","==v)o[g]="N";else if("%"==v){for(var y=void 0,y=g+1;y<r&&"%"==o[y];++y);for(var x=g&&"!"==o[g-1]||y<r&&"1"==o[y]?"1":"N",b=g;b<y;++b)o[b]=x;g=y-1}}for(var w=0,C=n;w<r;++w){var k=o[w];"L"==C&&"1"==k?o[w]="L":Re.test(k)&&(C=k)}for(var S=0;S<r;++S)if(Pe.test(o[S])){for(var L=void 0,L=S+1;L<r&&Pe.test(o[L]);++L);for(var T="L"==(S?o[S-1]:n),M=T==("L"==(L<r?o[L]:n))?T?"L":"R":n,N=S;N<L;++N)o[N]=M;S=L-1}for(var D,A=[],F=0;F<r;)if(Be.test(o[F])){var W=F;for(++F;F<r&&Be.test(o[F]);++F);A.push(new qe(0,W,F))}else{var E=F,O=A.length,H="rtl"==t?1:0;for(++F;F<r&&"L"!=o[F];++F);for(var I=E;I<F;)if(ze.test(o[I])){E<I&&(A.splice(O,0,new qe(1,E,I)),O+=H);var P=I;for(++I;I<F&&ze.test(o[I]);++I);A.splice(O,0,new qe(2,P,I)),O+=H,E=I}else++I;E<F&&A.splice(O,0,new qe(1,E,F))}return"ltr"==t&&(1==A[0].level&&(D=e.match(/^\s+/))&&(A[0].from=D[0].length,A.unshift(new qe(0,0,D[0].length))),1==R(A).level)&&(D=e.match(/\s+$/))&&(R(A).to-=D[0].length,A.push(new qe(0,r-D[0].length,r))),"rtl"==t?A.reverse():A};function qe(e,t,n){this.level=e,this.from=t,this.to=n}function _e(e,t){var n=e.order;return n=null==n?e.order=je(e.text,t):n}var Ue=[],S=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):(e=e._handlers||(e._handlers={}))[t]=(e[t]||Ue).concat(n)};function Ge(e,t){return e._handlers&&e._handlers[t]||Ue}function L(e,t,n){var i;e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):(i=(e=e._handlers)&&e[t])&&-1<(n=k(i,n))&&(e[t]=i.slice(0,n).concat(i.slice(n+1)))}function D(e,t){var n=Ge(e,t);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r<n.length;++r)n[r].apply(null,i)}function A(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),D(e,n||t.type,e,t),Ye(t)||t.codemirrorIgnore}function Ve(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)-1==k(n,t[i])&&n.push(t[i])}function $e(e,t){return 0<Ge(e,t).length}function Xe(e){e.prototype.on=function(e,t){S(this,e,t)},e.prototype.off=function(e,t){L(this,e,t)}}function T(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Ke(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ye(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ze(e){T(e),Ke(e)}function Qe(e){return e.target||e.srcElement}function Je(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),t=C&&e.ctrlKey&&1==t?3:t}var et,tt,nt=!(b&&v<9)&&("draggable"in(a=M("div"))||"dragDrop"in a);var it=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],i=e.length;t<=i;){var r=e.indexOf("\n",t),o=(-1==r&&(r=e.length),e.slice(t,"\r"==e.charAt(r-1)?r-1:r)),l=o.indexOf("\r");-1!=l?(n.push(o.slice(0,l)),t+=l+1):(n.push(o),t=r+1)}return n}:function(e){return e.split(/\r\n?|\n/)},rt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},ot="oncopy"in(e=M("div"))||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy),lt=null;var at={},st={};function ct(e){if("string"==typeof e&&st.hasOwnProperty(e))e=st[e];else if(e&&"string"==typeof e.name&&st.hasOwnProperty(e.name)){var t=st[e.name];(e=Le(t="string"==typeof t?{name:t}:t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ct("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ct("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function ut(e,t){t=ct(t);var n=at[t.name];if(!n)return ut(e,"text/plain");var i=n(e,t);if(dt.hasOwnProperty(t.name)){var r,o=dt[t.name];for(r in o)o.hasOwnProperty(r)&&(i.hasOwnProperty(r)&&(i["_"+r]=i[r]),i[r]=o[r])}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)i[l]=t.modeProps[l];return i}var dt={};function ht(e,t){he(t,dt.hasOwnProperty(e)?dt[e]:dt[e]={})}function ft(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n,i={};for(n in t){var r=t[n];r instanceof Array&&(r=r.concat([])),i[n]=r}return i}function pt(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function mt(e,t,n){return!e.startState||e.startState(t,n)}var m=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function F(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(t<o){n=r;break}t-=o}return n.lines[t]}function gt(e,t,n){var i=[],r=t.line;return e.iter(t.line,n.line+1,function(e){e=e.text;r==n.line&&(e=e.slice(0,n.ch)),r==t.line&&(e=e.slice(t.ch)),i.push(e),++r}),i}function vt(e,t,n){var i=[];return e.iter(t,n,function(e){i.push(e.text)}),i}function yt(e,t){var n=t-e.height;if(n)for(var i=e;i;i=i.parent)i.height+=n}function E(e){if(null==e.parent)return null;for(var t=e.parent,n=k(t.lines,e),i=t.parent;i;i=(t=i).parent)for(var r=0;i.children[r]!=t;++r)n+=i.children[r].chunkSize();return n+t.first}function xt(e,t){var n=e.first;e:do{for(var i=0;i<e.children.length;++i){var r=e.children[i],o=r.height;if(t<o){e=r;continue e}t-=o,n+=r.chunkSize()}return n}while(!e.lines);for(var l=0;l<e.lines.length;++l){var a=e.lines[l].height;if(t<a)break;t-=a}return n+l}function bt(e,t){return t>=e.first&&t<e.first+e.size}function wt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function O(e,t,n){if(void 0===n&&(n=null),!(this instanceof O))return new O(e,t,n);this.line=e,this.ch=t,this.sticky=n}function H(e,t){return e.line-t.line||e.ch-t.ch}function Ct(e,t){return e.sticky==t.sticky&&0==H(e,t)}function kt(e){return O(e.line,e.ch)}function St(e,t){return H(e,t)<0?t:e}function Lt(e,t){return H(e,t)<0?e:t}function Tt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function I(e,t){var n;return t.line<e.first?O(e.first,0):(n=e.first+e.size-1,t.line>n?O(n,F(e,n).text.length):(e=F(e,(n=t).line).text.length,null==(t=n.ch)||e<t?O(n.line,e):t<0?O(n.line,0):n))}function Mt(e,t){for(var n=[],i=0;i<t.length;i++)n[i]=I(e,t[i]);return n}m.prototype.eol=function(){return this.pos>=this.string.length},m.prototype.sol=function(){return this.pos==this.lineStart},m.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},m.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},m.prototype.eat=function(e){var t=this.string.charAt(this.pos),e="string"==typeof e?t==e:t&&(e.test?e.test(t):e(t));if(e)return++this.pos,t},m.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},m.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},m.prototype.skipToEnd=function(){this.pos=this.string.length},m.prototype.skipTo=function(e){e=this.string.indexOf(e,this.pos);if(-1<e)return this.pos=e,!0},m.prototype.backUp=function(e){this.pos-=e},m.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=fe(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?fe(this.string,this.lineStart,this.tabSize):0)},m.prototype.indentation=function(){return fe(this.string,null,this.tabSize)-(this.lineStart?fe(this.string,this.lineStart,this.tabSize):0)},m.prototype.match=function(e,t,n){var i;return"string"!=typeof e?(i=this.string.slice(this.pos).match(e))&&0<i.index?null:(i&&!1!==t&&(this.pos+=i[0].length),i):(i=function(e){return n?e.toLowerCase():e})(this.string.substr(this.pos,e.length))==i(e)?(!1!==t&&(this.pos+=e.length),!0):void 0},m.prototype.current=function(){return this.string.slice(this.start,this.pos)},m.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},m.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},m.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Nt(e,t){this.state=e,this.lookAhead=t}var Dt=function(e,t,n,i){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};function At(t,n,i,e){for(var s=[t.state.modeGen],r={},c=(Bt(t,n.text,t.doc.mode,i,function(e,t){s.push(e,t)},r,e),i.state),o=0;o<t.state.overlays.length;++o)!function(e){i.baseTokens=s;var o=t.state.overlays[e],l=1,a=0;i.state=!0,Bt(t,n.text,o.mode,i,function(e,t){for(var n=l;a<e;){var i=s[l];e<i&&s.splice(l,1,e,s[l+1],i),l+=2,a=Math.min(e,i)}if(t)if(o.opaque)s.splice(n,l-n,e,"overlay "+t),l=n+2;else for(;n<l;n+=2){var r=s[n+1];s[n+1]=(r?r+" ":"")+"overlay "+t}},r),i.state=c,i.baseTokens=null,i.baseTokenPos=1}(o);return{styles:s,classes:r.bgClass||r.textClass?r:null}}function Ft(e,t,n){var i,r,o;return t.styles&&t.styles[0]==e.state.modeGen||(i=Et(e,E(t)),r=t.text.length>e.options.maxHighlightLength&&ft(e.doc.mode,i.state),o=At(e,t,i),r&&(i.state=r),t.stateAfter=i.save(!r),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))),t.styles}function Et(n,i,e){var t,r,o,l=n.doc,a=n.display;return l.mode.startState?(r=(t=function(e,t,n){for(var i,r,o=e.doc,l=n?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;l<a;--a){if(a<=o.first)return o.first;var s=F(o,a-1),c=s.stateAfter;if(c&&(!n||a+(c instanceof Nt?c.lookAhead:0)<=o.modeFrontier))return a;c=fe(s.text,null,e.options.tabSize);(null==r||c<i)&&(r=a-1,i=c)}return r}(n,i,e))>l.first&&F(l,t-1).stateAfter,o=r?Dt.fromSaved(l,r,t):new Dt(l,mt(l.mode),t),l.iter(t,i,function(e){Ot(n,e.text,o);var t=o.line;e.stateAfter=t==i-1||t%5==0||t>=a.viewFrom&&t<a.viewTo?o.save():null,o.nextLine()}),e&&(l.modeFrontier=o.line),o):new Dt(l,!0,i)}function Ot(e,t,n,i){var r=e.doc.mode,o=new m(t,e.options.tabSize,n);for(o.start=o.pos=i||0,""==t&&Ht(r,n.state);!o.eol();)It(r,o,n.state),o.start=o.pos}function Ht(e,t){return e.blankLine?e.blankLine(t):e.innerMode&&(e=pt(e,t)).mode.blankLine?e.mode.blankLine(e.state):void 0}function It(e,t,n,i){for(var r=0;r<10;r++){i&&(i[0]=pt(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}Dt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Dt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Dt.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},Dt.fromSaved=function(e,t,n){return t instanceof Nt?new Dt(e,ft(e.mode,t.state),n,t.lookAhead):new Dt(e,ft(e.mode,t),n)},Dt.prototype.save=function(e){e=!1!==e?ft(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new Nt(e,this.maxLookAhead):e};var Wt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Pt(e,t,n,i){var r,o,l=e.doc,a=l.mode,s=F(l,(t=I(l,t)).line),c=Et(e,t.line,n),u=new m(s.text,e.options.tabSize,c);for(i&&(o=[]);(i||u.pos<t.ch)&&!u.eol();)u.start=u.pos,r=It(a,u,c.state),i&&o.push(new Wt(u,r,ft(l.mode,c.state)));return i?o:new Wt(u,r,c.state)}function Rt(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var i=n[1]?"bgClass":"textClass";null==t[i]?t[i]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+n[2])}return e}function Bt(e,t,n,i,r,o,l){var a=n.flattenSpans,s=(null==a&&(a=e.options.flattenSpans),0),c=null,u=new m(t,e.options.tabSize,i),d=e.options.addModeClass&&[null];for(""==t&&Rt(Ht(n,i.state),o);!u.eol();){var h,f=u.pos>e.options.maxHighlightLength?(a=!1,l&&Ot(e,t,i,u.pos),u.pos=t.length,null):Rt(It(n,u,i.state,d),o);if(d&&(h=d[0].name)&&(f="m-"+(f?h+" "+f:h)),!a||c!=f){for(;s<u.start;)r(s=Math.min(u.start,s+5e3),c);c=f}u.start=u.pos}for(;s<u.pos;){var p=Math.min(u.pos,s+5e3);r(p,c),s=p}}var zt=!1,jt=!1;function qt(e,t,n){this.marker=e,this.from=t,this.to=n}function _t(e,t){if(e)for(var n=0;n<e.length;++n){var i=e[n];if(i.marker==t)return i}}function Ut(e,t){if(t.full)return null;var n=bt(e,t.from.line)&&F(e,t.from.line).markedSpans,e=bt(e,t.to.line)&&F(e,t.to.line).markedSpans;if(!n&&!e)return null;var i=t.from.ch,r=t.to.ch,o=0==H(t.from,t.to),l=function(e,t,n){var i;if(e)for(var r=0;r<e.length;++r){var o,l=e[r],a=l.marker;!(null==l.from||(a.inclusiveLeft?l.from<=t:l.from<t))&&(l.from!=t||"bookmark"!=a.type||n&&l.marker.insertLeft)||(o=null==l.to||(a.inclusiveRight?l.to>=t:l.to>t),(i=i||[]).push(new qt(a,l.from,o?null:l.to)))}return i}(n,i,o),a=function(e,t,n){var i;if(e)for(var r=0;r<e.length;++r){var o,l=e[r],a=l.marker;!(null==l.to||(a.inclusiveRight?l.to>=t:l.to>t))&&(l.from!=t||"bookmark"!=a.type||n&&!l.marker.insertLeft)||(o=null==l.from||(a.inclusiveLeft?l.from<=t:l.from<t),(i=i||[]).push(new qt(a,o?null:l.from-t,null==l.to?null:l.to-t)))}return i}(e,r,o),s=1==t.text.length,c=R(t.text).length+(s?i:0);if(l)for(var u=0;u<l.length;++u){var d,h=l[u];null==h.to&&((d=_t(a,h.marker))?s&&(h.to=null==d.to?null:d.to+c):h.to=i)}if(a)for(var f=0;f<a.length;++f){var p=a[f];null!=p.to&&(p.to+=c),null==p.from?_t(l,p.marker)||(p.from=c,s&&(l=l||[]).push(p)):(p.from+=c,s&&(l=l||[]).push(p))}l=l&&Gt(l),a&&a!=l&&(a=Gt(a));var m=[l];if(!s){var g,v=t.text.length-2;if(0<v&&l)for(var y=0;y<l.length;++y)null==l[y].to&&(g=g||[]).push(new qt(l[y].marker,null,null));for(var x=0;x<v;++x)m.push(g);m.push(a)}return m}function Gt(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Vt(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function $t(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Xt(e){return e.inclusiveLeft?-1:0}function Kt(e){return e.inclusiveRight?1:0}function Yt(e,t){var n,i,r=e.lines.length-t.lines.length;return 0!=r?r:(r=e.find(),n=t.find(),(i=H(r.from,n.from)||Xt(e)-Xt(t))?-i:H(r.to,n.to)||Kt(e)-Kt(t)||t.id-e.id)}function Zt(e,t){var n,i=jt&&e.markedSpans;if(i)for(var r,o=0;o<i.length;++o)(r=i[o]).marker.collapsed&&null==(t?r.from:r.to)&&(!n||Yt(n,r.marker)<0)&&(n=r.marker);return n}function Qt(e){return Zt(e,!0)}function Jt(e){return Zt(e,!1)}function en(e,t,n,i,r){var e=F(e,t),o=jt&&e.markedSpans;if(o)for(var l=0;l<o.length;++l){var a=o[l];if(a.marker.collapsed){var s=a.marker.find(0),c=H(s.from,n)||Xt(a.marker)-Xt(r),u=H(s.to,i)||Kt(a.marker)-Kt(r);if(!(0<=c&&u<=0||c<=0&&0<=u)&&(c<=0&&(a.marker.inclusiveRight&&r.inclusiveLeft?0<=H(s.to,n):0<H(s.to,n))||0<=c&&(a.marker.inclusiveRight&&r.inclusiveLeft?H(s.from,i)<=0:H(s.from,i)<0)))return 1}}}function tn(e){for(var t;t=Qt(e);)e=t.find(-1,!0).line;return e}function nn(e,t){var e=F(e,t),n=tn(e);return e==n?t:E(n)}function rn(e,t){if(t>e.lastLine())return t;var n,i=F(e,t);if(!on(e,i))return t;for(;n=Jt(i);)i=n.find(1,!0).line;return E(i)+1}function on(e,t){var n=jt&&t.markedSpans;if(n)for(var i,r=0;r<n.length;++r)if((i=n[r]).marker.collapsed){if(null==i.from)return!0;if(!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&function e(t,n,i){{var r;if(null==i.to)return r=i.marker.find(1,!0),e(t,r.line,_t(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==n.text.length)return!0;for(var o=void 0,l=0;l<n.markedSpans.length;++l)if((o=n.markedSpans[l]).marker.collapsed&&!o.marker.widgetNode&&o.from==i.to&&(null==o.to||o.to!=i.from)&&(o.marker.inclusiveLeft||i.marker.inclusiveRight)&&e(t,n,o))return!0}(e,t,i))return!0}}function ln(e){for(var t=0,n=(e=tn(e)).parent,i=0;i<n.lines.length;++i){var r=n.lines[i];if(r==e)break;t+=r.height}for(var o=n.parent;o;o=(n=o).parent)for(var l=0;l<o.children.length;++l){var a=o.children[l];if(a==n)break;t+=a.height}return t}function an(e){if(0==e.height)return 0;for(var t,n=e.text.length,i=e;t=Qt(i);){var r=t.find(0,!0),i=r.from.line;n+=r.from.ch-r.to.ch}for(i=e;t=Jt(i);)var o=t.find(0,!0),n=(n-=i.text.length-o.from.ch)+((i=o.to.line).text.length-o.to.ch);return n}function sn(e){var n=e.display,e=e.doc;n.maxLine=F(e,e.first),n.maxLineLength=an(n.maxLine),n.maxLineChanged=!0,e.iter(function(e){var t=an(e);t>n.maxLineLength&&(n.maxLineLength=t,n.maxLine=e)})}var cn=function(e,t,n){this.text=e,$t(this,t),this.height=n?n(this):1};cn.prototype.lineNo=function(){return E(this)},Xe(cn);var un={},dn={};function hn(e,t){return!e||/^\s*$/.test(e)?null:(t=t.addModeClass?dn:un)[e]||(t[e]=e.replace(/\S+/g,"cm-$&"))}function fn(e,t){var n=te("span",null,null,w?"padding-right: .1px":null),i={pre:te("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var r,o,l=0;l<=(t.rest?t.rest.length:0);l++){var a=l?t.rest[l-1]:t.line,s=void 0,c=(i.pos=0,i.addToken=mn,c=e.display.measure,o=r=void 0,(null!=tt?tt:(o=y(c,document.createTextNode("AخA")),r=oe(o,0,1).getBoundingClientRect(),o=oe(o,1,2).getBoundingClientRect(),ee(c),r&&r.left!=r.right&&(tt=o.right-r.right<3)))&&(s=_e(a,e.doc.direction))&&(i.addToken=function(d,h){return function(e,t,n,i,r,o,l){n=n?n+" cm-force-border":"cm-force-border";for(var a=e.pos,s=a+t.length;;){for(var c=void 0,u=0;u<h.length&&!((c=h[u]).to>a&&c.from<=a);u++);if(c.to>=s)return d(e,t,n,i,r,o,l);d(e,t.slice(0,c.to-a),n,i,null,o,l),i=null,t=t.slice(c.to-a),a=c.to}}}(i.addToken,s)),i.map=[],t!=e.display.externalMeasured&&E(a));!function(e,t,n){var i=e.markedSpans,r=e.text,o=0;if(i)for(var l,a,s,c,u,d,h,f=r.length,p=0,m=1,g="",v=0;;){if(v==p){s=c=u=a="",d=h=null,v=1/0;for(var y=[],x=void 0,b=0;b<i.length;++b){var w=i[b],C=w.marker;if("bookmark"==C.type&&w.from==p&&C.widgetNode)y.push(C);else if(w.from<=p&&(null==w.to||w.to>p||C.collapsed&&w.to==p&&w.from==p)){if(null!=w.to&&w.to!=p&&v>w.to&&(v=w.to,c=""),C.className&&(s+=" "+C.className),C.css&&(a=(a?a+";":"")+C.css),C.startStyle&&w.from==p&&(u+=" "+C.startStyle),C.endStyle&&w.to==v&&(x=x||[]).push(C.endStyle,w.to),C.title&&((h=h||{}).title=C.title),C.attributes)for(var k in C.attributes)(h=h||{})[k]=C.attributes[k];C.collapsed&&(!d||Yt(d.marker,C)<0)&&(d=w)}else w.from>p&&v>w.from&&(v=w.from)}if(x)for(var S=0;S<x.length;S+=2)x[S+1]==v&&(c+=" "+x[S]);if(!d||d.from==p)for(var L=0;L<y.length;++L)gn(t,0,y[L]);if(d&&(d.from||0)==p){if(gn(t,(null==d.to?f+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(f<=p)break;for(var T=Math.min(f,v);;){if(g){var M,N=p+g.length;if(d||(M=T<N?g.slice(0,T-p):g,t.addToken(t,M,l?l+s:s,u,p+M.length==v?c:"",a,h)),T<=N){g=g.slice(T-p),p=T;break}p=N,u=""}g=r.slice(o,o=n[m++]),l=hn(n[m++],t.cm.options)}}else for(var D=1;D<n.length;D+=2)t.addToken(t,r.slice(o,o=n[D]),hn(n[D+1],t.cm.options))}(a,i,Ft(e,a,c)),a.styleClasses&&(a.styleClasses.bgClass&&(i.bgClass=re(a.styleClasses.bgClass,i.bgClass||"")),a.styleClasses.textClass)&&(i.textClass=re(a.styleClasses.textClass,i.textClass||"")),0==i.map.length&&i.map.push(0,0,i.content.appendChild((o=e.display.measure,r=void 0,(o=(et=null==et&&(r=M("span",""),y(o,M("span",[r,document.createTextNode("x")])),0!=o.firstChild.offsetHeight)?r.offsetWidth<=1&&2<r.offsetHeight&&!(b&&v<8):et)?M("span",""):M("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")).setAttribute("cm-text",""),o))),0==l?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return w&&(n=i.content.lastChild,/\bcm-tab\b/.test(n.className)||n.querySelector&&n.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack"),D(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=re(i.pre.className,i.textClass||"")),i}function pn(e){var t=M("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function mn(e,t,n,i,r,o,l){if(t){var a=e.splitSpaces?function(e,t){if(1<e.length&&!/ /.test(e))return e;for(var n=t,i="",r=0;r<e.length;r++){var o=e.charAt(r);" "!=o||!n||r!=e.length-1&&32!=e.charCodeAt(r+1)||(o=" "),i+=o,n=" "==o}return i}(t,e.trailingSpace):t,s=e.cm.state.specialChars,c=!1;if(s.test(t))for(var u=document.createDocumentFragment(),d=0;;){s.lastIndex=d;var h=s.exec(t),f=h?h.index-d:t.length-d;if(f&&(p=document.createTextNode(a.slice(d,d+f)),b&&v<9?u.appendChild(M("span",[p])):u.appendChild(p),e.map.push(e.pos,e.pos+f,p),e.col+=f,e.pos+=f),!h)break;d+=1+f;var p=void 0;"\t"==h[0]?(f=(f=e.cm.options.tabSize)-e.col%f,(p=u.appendChild(M("span",Ce(f),"cm-tab"))).setAttribute("role","presentation"),p.setAttribute("cm-text","\t"),e.col+=f):("\r"==h[0]||"\n"==h[0]?(p=u.appendChild(M("span","\r"==h[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",h[0]):((p=e.cm.options.specialCharPlaceholder(h[0])).setAttribute("cm-text",h[0]),b&&v<9?u.appendChild(M("span",[p])):u.appendChild(p)),e.col+=1),e.map.push(e.pos,e.pos+1,p),e.pos++}else e.col+=t.length,u=document.createTextNode(a),e.map.push(e.pos,e.pos+t.length,u),b&&v<9&&(c=!0),e.pos+=t.length;if(e.trailingSpace=32==a.charCodeAt(t.length-1),n||i||r||c||o||l){var c=n||"",m=(i&&(c+=i),r&&(c+=r),M("span",[u],c,o));if(l)for(var g in l)l.hasOwnProperty(g)&&"style"!=g&&"class"!=g&&m.setAttribute(g,l[g]);return e.content.appendChild(m)}e.content.appendChild(u)}}function gn(e,t,n,i){var r=!i&&n.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!i&&e.cm.display.input.needsContentAttribute&&(r=r||e.content.appendChild(document.createElement("span"))).setAttribute("cm-marker",n.id),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t,e.trailingSpace=!1}function vn(e,t,n){this.line=t,this.rest=function(e){for(var t,n;t=Jt(e);)e=t.find(1,!0).line,(n=n||[]).push(e);return n}(t),this.size=this.rest?E(R(this.rest))-n+1:1,this.node=this.text=null,this.hidden=on(e,t)}function yn(e,t,n){for(var i=[],r=t;r<n;r=l){var o=new vn(e.doc,F(e.doc,r),r),l=r+o.size;i.push(o)}return i}var xn=null;var bn=null;function x(e,t){var n=Ge(e,t);if(n.length)for(var i,r=Array.prototype.slice.call(arguments,2),o=(xn?i=xn.delayedCallbacks:bn?i=bn:(i=bn=[],setTimeout(wn,0)),0);o<n.length;++o)!function(e){i.push(function(){return n[e].apply(null,r)})}(o)}function wn(){var e=bn;bn=null;for(var t=0;t<e.length;++t)e[t]()}function Cn(e,t,n,i){for(var r=0;r<t.changes.length;r++){var o=t.changes[r];if("text"==o){c=s=a=l=void 0;var l=e,a=t,s=a.text.className,c=Sn(l,a);a.text==a.node&&(a.node=c.pre),a.text.parentNode.replaceChild(c.pre,a.text),a.text=c.pre,c.bgClass!=a.bgClass||c.textClass!=a.textClass?(a.bgClass=c.bgClass,a.textClass=c.textClass,Ln(l,a)):s&&(a.text.className=s)}else if("gutter"==o)Tn(e,t,n,i);else if("class"==o)Ln(e,t);else if("widget"==o){f=h=d=l=u=c=void 0;var c=e,u=t,l=i;u.alignable&&(u.alignable=null);for(var d=Q("CodeMirror-linewidget"),h=u.node.firstChild,f=void 0;h;h=f)f=h.nextSibling,d.test(h.className)&&u.node.removeChild(h);Mn(c,u,l)}}t.changes=null}function kn(e){return e.node==e.text&&(e.node=M("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),b)&&v<8&&(e.node.style.zIndex=2),e.node}function Sn(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):fn(e,t)}function Ln(e,t){e=e,(r=(n=t).bgClass?n.bgClass+" "+(n.line.bgClass||""):n.line.bgClass)&&(r+=" CodeMirror-linebackground"),n.background?r?n.background.className=r:(n.background.parentNode.removeChild(n.background),n.background=null):r&&(i=kn(n),n.background=i.insertBefore(M("div",null,r),i.firstChild),e.display.input.setUneditable(n.background)),t.line.wrapClass?kn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n,i,r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function Tn(e,t,n,i){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass&&(o=kn(t),t.gutterBackground=M("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text));var r=t.line.gutterMarkers;if(e.options.lineNumbers||r){var o=kn(t),l=t.gutter=M("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(l.setAttribute("aria-hidden","true"),e.display.input.setUneditable(l),o.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||r&&r["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(M("div",wt(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),r)for(var a=0;a<e.display.gutterSpecs.length;++a){var s=e.display.gutterSpecs[a].className,c=r.hasOwnProperty(s)&&r[s];c&&l.appendChild(M("div",[c],"CodeMirror-gutter-elt","left: "+i.gutterLeft[s]+"px; width: "+i.gutterWidth[s]+"px"))}}}function Mn(e,t,n){if(Nn(e,t.line,t,n,!0),t.rest)for(var i=0;i<t.rest.length;i++)Nn(e,t.rest[i],t,n,!1)}function Nn(e,t,n,i,r){if(t.widgets)for(var o=kn(n),l=0,a=t.widgets;l<a.length;++l){var s=a[l],c=M("div",[s.node],"CodeMirror-linewidget"+(s.className?" "+s.className:"")),u=(s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),f=h=d=u=void 0,s),d=c,h=n,f=i;u.noHScroll&&((h.alignable||(h.alignable=[])).push(d),h=f.wrapperWidth,d.style.left=f.fixedPos+"px",u.coverGutter||(h-=f.gutterTotalWidth,d.style.paddingLeft=f.gutterTotalWidth+"px"),d.style.width=h+"px"),u.coverGutter&&(d.style.zIndex=5,d.style.position="relative",u.noHScroll||(d.style.marginLeft=-f.gutterTotalWidth+"px")),e.display.input.setUneditable(c),r&&s.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),x(s,"redraw")}}function Dn(e){var t,n;return null!=e.height?e.height:(t=e.doc.cm)?(ne(document.body,e.node)||(n="position: relative;",e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),y(t.display.measure,M("div",[e.node],null,n))),e.height=e.node.parentNode.offsetHeight):0}function An(e,t){for(var n=Qe(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return 1}function Fn(e){return e.lineSpace.offsetTop}function En(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function On(e){var t;return e.cachedPaddingH||(t=y(e.measure,M("pre","x","CodeMirror-line-like")),t=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,t={left:parseInt(t.paddingLeft),right:parseInt(t.paddingRight)},isNaN(t.left)||isNaN(t.right)||(e.cachedPaddingH=t),t)}function Hn(e){return me-e.display.nativeBarWidth}function In(e){return e.display.scroller.clientWidth-Hn(e)-e.display.barWidth}function Wn(e){return e.display.scroller.clientHeight-Hn(e)-e.display.barHeight}function Pn(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var r=0;r<e.rest.length;r++)if(E(e.rest[r])>n)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}}function Rn(e,t,n,i){return jn(e,zn(e,t),n,i)}function Bn(e,t){return t>=e.display.viewFrom&&t<e.display.viewTo?e.display.view[gi(e,t)]:(e=e.display.externalMeasured)&&t>=e.lineN&&t<e.lineN+e.size?e:void 0}function zn(e,t){var n,i,r=E(t),o=Bn(e,r),e=(o&&!o.text?o=null:o&&o.changes&&(Cn(e,o,r,di(e)),e.curOp.forceUpdate=!0),o||(e=e,i=E(n=tn(n=t)),(n=e.display.externalMeasured=new vn(e.doc,n,i)).lineN=i,i=n.built=fn(e,n),n.text=i.pre,y(e.display.lineMeasure,i.pre),o=n),Pn(o,t,r));return{line:t,view:o,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function jn(e,t,n,i,r){var o,l=(n=t.before?-1:n)+(i||"");if(t.cache.hasOwnProperty(l))o=t.cache[l];else{if(t.rect||(t.rect=t.view.text.getBoundingClientRect()),!t.hasHeights){var a=e,s=t.view,c=t.rect,u=a.options.lineWrapping,a=u&&In(a);if(!s.measure.heights||u&&s.measure.width!=a){var d=s.measure.heights=[];if(u){s.measure.width=a;for(var h=s.text.firstChild.getClientRects(),f=0;f<h.length-1;f++){var p=h[f],m=h[f+1];2<Math.abs(p.bottom-m.bottom)&&d.push((p.bottom+m.top)/2-c.top)}}d.push(c.bottom-c.top)}t.hasHeights=!0}(o=function(e,t,n,i){var r,o=Un(t.map,n,i),l=o.node,a=o.start,s=o.end,c=o.collapse;if(3==l.nodeType){for(var u=0;u<4;u++){for(;a&&Fe(t.line.text.charAt(o.coverStart+a));)--a;for(;o.coverStart+s<o.coverEnd&&Fe(t.line.text.charAt(o.coverStart+s));)++s;if((r=b&&v<9&&0==a&&s==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():function(e,t){var n=_n;if("left"==t)for(var i=0;i<e.length&&(n=e[i]).left==n.right;i++);else for(var r=e.length-1;0<=r&&(n=e[r]).left==n.right;r--);return n}(oe(l,a,s).getClientRects(),i)).left||r.right||0==a)break;s=a,a-=1,c="right"}b&&v<11&&(r=function(e,t){var n;return window.screen&&null!=screen.logicalXDPI&&screen.logicalXDPI!=screen.deviceXDPI&&function(e){var t;return null!=lt?lt:(t=(e=y(e,M("span","x"))).getBoundingClientRect(),e=oe(e,0,1).getBoundingClientRect(),lt=1<Math.abs(t.left-e.left))}(e)?(e=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI,{left:t.left*e,right:t.right*e,top:t.top*n,bottom:t.bottom*n}):t}(e.display.measure,r))}else 0<a&&(c=i="right"),r=e.options.lineWrapping&&1<(n=l.getClientRects()).length?n["right"==i?n.length-1:0]:l.getBoundingClientRect();!(b&&v<9)||a||r&&(r.left||r.right)||(n=l.parentNode.getClientRects()[0],r=n?{left:n.left,right:n.left+ui(e.display),top:n.top,bottom:n.bottom}:_n);for(var n=r.top-t.rect.top,d=r.bottom-t.rect.top,h=(n+d)/2,f=t.view.measure.heights,p=0;p<f.length-1&&!(h<f[p]);p++);var m=p?f[p-1]:0,g=f[p],m={left:("right"==c?r.right:r.left)-t.rect.left,right:("left"==c?r.left:r.right)-t.rect.left,top:m,bottom:g};r.left||r.right||(m.bogus=!0);e.options.singleCursorHeightPerLine||(m.rtop=n,m.rbottom=d);return m}(e,t,n,i)).bogus||(t.cache[l]=o)}return{left:o.left,right:o.right,top:r?o.rtop:o.top,bottom:r?o.rbottom:o.bottom}}var qn,_n={left:0,right:0,top:0,bottom:0};function Un(e,t,n){for(var i,r,o,l,a,s,c=0;c<e.length;c+=3)if(a=e[c],s=e[c+1],t<a?(r=0,o=1,l="left"):t<s?o=(r=t-a)+1:(c==e.length-3||t==s&&e[c+3]>t)&&(r=(o=s-a)-1,s<=t)&&(l="right"),null!=r){if(i=e[c+2],a==s&&n==(i.insertLeft?"left":"right")&&(l=n),"left"==n&&0==r)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)i=e[2+(c-=3)],l="left";if("right"==n&&r==s-a)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)i=e[(c+=3)+2],l="right";break}return{node:i,start:r,end:o,collapse:l,coverStart:a,coverEnd:s}}function Gn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Vn(e){e.display.externalMeasure=null,ee(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Gn(e.display.view[t])}function $n(e){Vn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Xn(e){return q&&$?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function Kn(e){return q&&$?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function Yn(e){var t=tn(e).widgets,n=0;if(t)for(var i=0;i<t.length;++i)t[i].above&&(n+=Dn(t[i]));return n}function Zn(e,t,n,i,r){return r||(r=Yn(t),n.top+=r,n.bottom+=r),"line"!=i&&(i=i||"local",r=ln(t),"local"==i?r+=Fn(e.display):r-=e.display.viewOffset,"page"!=i&&"window"!=i||(r+=(t=e.display.lineSpace.getBoundingClientRect()).top+("window"==i?0:Kn(ae(e))),t=t.left+("window"==i?0:Xn(ae(e))),n.left+=t,n.right+=t),n.top+=r,n.bottom+=r),n}function Qn(e,t,n){var i;return"div"==n?t:(i=t.left,t=t.top,"page"==n?(i-=Xn(ae(e)),t-=Kn(ae(e))):"local"!=n&&n||(i+=(n=e.display.sizer.getBoundingClientRect()).left,t+=n.top),{left:i-(n=e.display.lineSpace.getBoundingClientRect()).left,top:t-n.top})}function Jn(e,t,n,i,r){return Zn(e,i=i||F(e.doc,t.line),Rn(e,i,t.ch,r),n)}function ei(n,e,i,r,o,l){function a(e,t){e=jn(n,o,e,t?"right":"left",l);return t?e.left=e.right:e.right=e.left,Zn(n,r,e,i)}r=r||F(n.doc,e.line),o=o||zn(n,r);var t,s,c=_e(r,n.doc.direction),u=e.ch,e=e.sticky;return u>=r.text.length?(u=r.text.length,e="before"):u<=0&&(u=0,e="after"),c?(s=Ie(c,u,e),t=He,s=d(u,s,"before"==e),null!=t&&(s.other=d(u,t,"before"!=e)),s):a("before"==e?u-1:u,"before"==e);function d(e,t,n){return a(n?e-1:e,1==c[t].level!=n)}}function ti(e,t){var n=0,t=(t=I(e.doc,t),e.options.lineWrapping||(n=ui(e.display)*t.ch),F(e.doc,t.line)),e=ln(t)+Fn(e.display);return{left:n,right:n,top:e,bottom:e+t.height}}function ni(e,t,n,i,r){e=O(e,t,n);return e.xRel=r,i&&(e.outside=i),e}function ii(e,t,n){var i=e.doc;if((n+=e.display.viewOffset)<0)return ni(i.first,0,null,-1,-1);var r=xt(i,n),o=i.first+i.size-1;if(o<r)return ni(i.first+i.size-1,F(i,o).text.length,null,1,1);t<0&&(t=0);for(var l=F(i,r);;){var a=function(n,e,t,i,r){r-=ln(e);var o=zn(n,e),l=Yn(e),a=0,s=e.text.length,c=!0,u=_e(e,n.doc.direction);u&&(u=(n.options.lineWrapping?si:ai)(n,e,t,o,u,i,r),c=1!=u.level,a=c?u.from:u.to-1,s=c?u.to:u.from-1);var d=null,h=null,u=Oe(function(e){var t=jn(n,o,e);return t.top+=l,t.bottom+=l,li(t,i,r,!1)&&(t.top<=r&&t.left<=i&&(d=e,h=t),1)},a,s),f=!1;{var p,m;h?(p=i-h.left<h.right-i,u=d+((m=p==c)?0:1),m=m?"after":"before",p=p?h.left:h.right):(c||u!=s&&u!=a||u++,m=0==u||u!=e.text.length&&jn(n,o,u-(c?1:0)).bottom+l<=r==c?"after":"before",s=ei(n,O(t,u,m),"line",e,o),p=s.left,f=r<s.top?-1:r>=s.bottom?1:0)}return u=Ee(e.text,u,1),ni(t,u,m,f,i-p)}(e,l,r,t,n),s=function(e,t){var n,i=jt&&e.markedSpans;if(i)for(var r=0;r<i.length;++r){var o=i[r];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||Yt(n,o.marker)<0)&&(n=o.marker)}return n}(l,a.ch+(0<a.xRel||0<a.outside?1:0));if(!s)return a;a=s.find(1);if(a.line==r)return a;l=F(i,r=a.line)}}function ri(t,e,n,i){i-=Yn(e);var e=e.text.length,r=Oe(function(e){return jn(t,n,e-1).bottom<=i},e,0);return{begin:r,end:Oe(function(e){return jn(t,n,e).top>i},r,e)}}function oi(e,t,n,i){return ri(e,t,n=n||zn(e,t),Zn(e,t,jn(e,n,i),"line").top)}function li(e,t,n,i){return!(e.bottom<=n)&&(e.top>n||(i?e.left:e.right)>t)}function ai(n,i,r,o,l,a,s){var e,t=Oe(function(e){var e=l[e],t=1!=e.level;return li(ei(n,O(r,t?e.to:e.from,t?"before":"after"),"line",i,o),a,s,!0)},0,l.length-1),c=l[t];return c=0<t&&(e=1!=c.level,li(e=ei(n,O(r,e?c.from:c.to,e?"after":"before"),"line",i,o),a,s,!0))&&e.top>s?l[t-1]:c}function si(e,t,n,i,r,o,l){for(var l=ri(e,t,i,l),a=l.begin,s=l.end,c=(/\s/.test(t.text.charAt(s-1))&&s--,null),u=null,d=0;d<r.length;d++){var h,f=r[d];f.from>=s||f.to<=a||(h=(h=jn(e,i,1!=f.level?Math.min(s,f.to)-1:Math.max(a,f.from)).right)<o?o-h+1e9:h-o,(!c||h<u)&&(c=f,u=h))}return c=(c=(c=c||r[r.length-1]).from<a?{from:a,to:c.to,level:c.level}:c).to>s?{from:c.from,to:s,level:c.level}:c}function ci(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==qn){qn=M("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)qn.appendChild(document.createTextNode("x")),qn.appendChild(M("br"));qn.appendChild(document.createTextNode("x"))}y(e.measure,qn);var n=qn.offsetHeight/50;return 3<n&&(e.cachedTextHeight=n),ee(e.measure),n||1}function ui(e){var t,n;return null!=e.cachedCharWidth?e.cachedCharWidth:(n=M("span","xxxxxxxxxx"),t=M("pre",[n],"CodeMirror-line-like"),y(e.measure,t),2<(n=((t=n.getBoundingClientRect()).right-t.left)/10)&&(e.cachedCharWidth=n),n||10)}function di(e){for(var t=e.display,n={},i={},r=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var a=e.display.gutterSpecs[l].className;n[a]=o.offsetLeft+o.clientLeft+r,i[a]=o.clientWidth}return{fixedPos:hi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function hi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function fi(i){var r=ci(i.display),o=i.options.lineWrapping,l=o&&Math.max(5,i.display.scroller.clientWidth/ui(i.display)-3);return function(e){if(on(i.doc,e))return 0;var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;n++)e.widgets[n].height&&(t+=e.widgets[n].height);return o?t+(Math.ceil(e.text.length/l)||1)*r:t+r}}function pi(e){var t=e.doc,n=fi(e);t.iter(function(e){var t=n(e);t!=e.height&&yt(e,t)})}function mi(e,t,n,i){var r=e.display;if(!n&&"true"==Qe(t).getAttribute("cm-not-content"))return null;var o,l,n=r.lineSpace.getBoundingClientRect();try{o=t.clientX-n.left,l=t.clientY-n.top}catch(e){return null}r=ii(e,o,l);return i&&0<r.xRel&&(t=F(e.doc,r.line).text).length==r.ch&&(n=fe(t,t.length,e.options.tabSize)-t.length,r=O(r.line,Math.max(0,Math.round((o-On(e.display).left)/ui(e.display))-n))),r}function gi(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,i=0;i<n.length;i++)if((t-=n[i].size)<0)return i}function W(e,t,n,i){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size);var r,o=e.display,l=((i=i||0)&&n<o.viewTo&&(null==o.updateLineNumbers||o.updateLineNumbers>t)&&(o.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=o.viewTo?jt&&nn(e.doc,t)<o.viewTo&&yi(e):n<=o.viewFrom?jt&&rn(e.doc,n+i)>o.viewFrom?yi(e):(o.viewFrom+=i,o.viewTo+=i):t<=o.viewFrom&&n>=o.viewTo?yi(e):t<=o.viewFrom?(l=xi(e,n,n+i,1))?(o.view=o.view.slice(l.index),o.viewFrom=l.lineN,o.viewTo+=i):yi(e):n>=o.viewTo?(l=xi(e,t,t,-1))?(o.view=o.view.slice(0,l.index),o.viewTo=l.lineN):yi(e):(l=xi(e,t,t,-1),r=xi(e,n,n+i,1),l&&r?(o.view=o.view.slice(0,l.index).concat(yn(e,l.lineN,r.lineN)).concat(o.view.slice(r.index)),o.viewTo+=i):yi(e)),o.externalMeasured);l&&(n<l.lineN?l.lineN+=i:t<l.lineN+l.size&&(o.externalMeasured=null))}function vi(e,t,n){e.curOp.viewChanged=!0;var i=e.display,r=e.display.externalMeasured;r&&t>=r.lineN&&t<r.lineN+r.size&&(i.externalMeasured=null),t<i.viewFrom||t>=i.viewTo||null!=(r=i.view[gi(e,t)]).node&&-1==k(i=r.changes||(r.changes=[]),n)&&i.push(n)}function yi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function xi(e,t,n,i){var r,o=gi(e,t),l=e.display.view;if(jt&&n!=e.doc.first+e.doc.size){for(var a=e.display.viewFrom,s=0;s<o;s++)a+=l[s].size;if(a!=t){if(0<i){if(o==l.length-1)return null;r=a+l[o].size-t,o++}else r=a-t;t+=r,n+=r}for(;nn(e.doc,n)!=n;){if(o==(i<0?0:l.length-1))return null;n+=i*l[o-(i<0?1:0)].size,o+=i}}return{index:o,lineN:n}}function bi(e){for(var t=e.display.view,n=0,i=0;i<t.length;i++){var r=t[i];r.hidden||r.node&&!r.changes||++n}return n}function wi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Ci(e,t){void 0===t&&(t=!0);var n=e.doc,i={},r=i.cursors=document.createDocumentFragment(),o=i.selection=document.createDocumentFragment(),l=e.options.$customCursor;l&&(t=!0);for(var a,s,c,u=0;u<n.sel.ranges.length;u++)!t&&u==n.sel.primIndex||((a=n.sel.ranges[u]).from().line>=e.display.viewTo||a.to().line<e.display.viewFrom||(s=a.empty(),l?(c=l(e,a))&&ki(e,c,r):(s||e.options.showCursorWhenSelecting)&&ki(e,a.head,r),s))||function(r,e,t){var n=r.display,o=r.doc,l=document.createDocumentFragment(),i=On(r.display),k=i.left,S=Math.max(n.sizerWidth,In(r)-n.sizer.offsetLeft)-i.right,L="ltr"==o.direction;function T(e,t,n,i){t<0&&(t=0),t=Math.round(t),i=Math.round(i),l.appendChild(M("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?S-e:n)+"px;\n height: "+(i-t)+"px"))}function a(n,m,g){var v,y,i=F(o,n),x=i.text.length;function b(e,t){return Jn(r,O(n,e),"div",i,t)}function w(e,t,n){e=oi(r,i,null,e),t="ltr"==t==("after"==n)?"left":"right";return b("after"==n?e.begin:e.end-(/\s/.test(i.text.charAt(e.end-1))?2:1),t)[t]}var C=_e(i,o.direction);return function(e,t,n,i){if(!e)return i(t,n,"ltr",0);for(var r=!1,o=0;o<e.length;++o){var l=e[o];(l.from<n&&l.to>t||t==n&&l.to==t)&&(i(Math.max(l.from,t),Math.min(l.to,n),1==l.level?"rtl":"ltr",o),r=!0)}r||i(t,n,"ltr")}(C,m||0,null==g?x:g,function(e,t,n,i){var r,o,l,a,s,c="ltr"==n,u=b(e,c?"left":"right"),d=b(t-1,c?"right":"left"),h=null==m&&0==e,f=null==g&&t==x,p=0==i,i=!C||i==C.length-1;d.top-u.top<=3?(r=(L?h:f)&&p?k:(c?u:d).left,s=(L?f:h)&&i?S:(c?d:u).right,T(r,u.top,s-r,u.bottom)):(s=c?(o=L&&h&&p?k:u.left,l=L?S:w(e,n,"before"),a=L?k:w(t,n,"after"),L&&f&&i?S:d.right):(o=L?w(e,n,"before"):k,l=!L&&h&&p?S:u.right,a=!L&&f&&i?k:d.left,L?w(t,n,"after"):S),T(o,u.top,l-o,u.bottom),u.bottom<d.top&&T(k,u.bottom,null,d.top),T(a,d.top,s-a,d.bottom)),(!v||Si(u,v)<0)&&(v=u),Si(d,v)<0&&(v=d),(!y||Si(u,y)<0)&&(y=u),Si(d,y)<0&&(y=d)}),{start:v,end:y}}n=e.from(),i=e.to();{var s;n.line==i.line?a(n.line,n.ch,i.ch):(e=F(o,n.line),s=F(o,i.line),s=tn(e)==tn(s),n=a(n.line,n.ch,s?e.text.length+1:null).end,e=a(i.line,s?0:null,i.ch).start,s&&(n.top<e.top-2?(T(n.right,n.top,null,n.bottom),T(k,e.top,e.left,e.bottom)):T(n.right,n.top,e.left-n.right,n.bottom)),n.bottom<e.top&&T(k,n.bottom,null,e.top))}t.appendChild(l)}(e,a,o);return i}function ki(e,t,n){var i=ei(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),r=n.appendChild(M("div"," ","CodeMirror-cursor"));r.style.left=i.left+"px",r.style.top=i.top+"px",r.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)&&(t=(t=Jn(e,t,"div",null,null)).right-t.left,r.style.width=(0<t?t:e.defaultCharWidth())+"px"),i.other&&((r=n.appendChild(M("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"))).style.display="",r.style.left=i.other.left+"px",r.style.top=i.other.top+"px",r.style.height=.85*(i.other.bottom-i.other.top)+"px")}function Si(e,t){return e.top-t.top||e.left-t.left}function Li(e){var t,n;e.state.focused&&(t=e.display,clearInterval(t.blinker),n=!0,t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){e.hasFocus()||Di(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden"))}function Ti(e){e.hasFocus()||(e.display.input.focus(),e.state.focused)||Ni(e)}function Mi(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused)&&Di(e)},100)}function Ni(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(D(e,"focus",e,t),e.state.focused=!0,ie(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),w&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Li(e))}function Di(e,t){e.state.delayingBlurEvent||(e.state.focused&&(D(e,"blur",e,t),e.state.focused=!1,J(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Ai(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=Math.max(0,t.scroller.getBoundingClientRect().top),r=t.lineDiv.getBoundingClientRect().top,o=0,l=0;l<t.view.length;l++){var a=t.view[l],s=e.options.lineWrapping,c=void 0,u=0;if(!a.hidden){r+=a.line.height,b&&v<8?(c=(d=a.node.offsetTop+a.node.offsetHeight)-n,n=d):(c=(d=a.node.getBoundingClientRect()).bottom-d.top,!s&&a.text.firstChild&&(u=a.text.firstChild.getBoundingClientRect().right-d.left-1));var d,s=a.line.height-c;if((.005<s||s<-.005)&&(r<i&&(o-=s),yt(a.line,c),Fi(a.line),a.rest))for(var h=0;h<a.rest.length;h++)Fi(a.rest[h]);u>e.display.sizerWidth&&(s=Math.ceil(u/ui(e.display)))>e.display.maxLineLength&&(e.display.maxLineLength=s,e.display.maxLine=a.line,e.display.maxLineChanged=!0)}}2<Math.abs(o)&&(t.scroller.scrollTop+=o)}function Fi(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],i=n.node.parentNode;i&&(n.height=i.offsetHeight)}}function Ei(e,t,n){var i,r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop,r=Math.floor(r-Fn(e)),o=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,r=xt(t,r),o=xt(t,o);return n&&n.ensure&&(i=n.ensure.from.line,n=n.ensure.to.line,i<r?o=xt(t,ln(F(t,r=i))+e.wrapper.clientHeight):Math.min(n,t.lastLine())>=o&&(r=xt(t,ln(F(t,n))-e.wrapper.clientHeight),o=n)),{from:r,to:Math.max(o,r+1)}}function Oi(e,t){var n=e.display,i=ci(e.display),r=(t.top<0&&(t.top=0),(e.curOp&&null!=e.curOp.scrollTop?e.curOp:n.scroller).scrollTop),o=Wn(e),l={},a=(t.bottom-t.top>o&&(t.bottom=t.top+o),e.doc.height+En(n)),s=t.top<i,i=t.bottom>a-i,i=(t.top<r?l.scrollTop=s?0:t.top:t.bottom>r+o&&(s=Math.min(t.top,(i?a:t.bottom)-o))!=r&&(l.scrollTop=s),e.options.fixedGutter?0:n.gutters.offsetWidth),a=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-i,o=In(e)-n.gutters.offsetWidth,r=t.right-t.left>o;return r&&(t.right=t.left+o),t.left<10?l.scrollLeft=0:t.left<a?l.scrollLeft=Math.max(0,t.left+i-(r?0:10)):t.right>o+a-3&&(l.scrollLeft=t.right+(r?0:10)-o),l}function Hi(e,t){null!=t&&(Pi(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc:e.curOp).scrollTop+t)}function Ii(e){Pi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Wi(e,t,n){null==t&&null==n||Pi(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Pi(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Ri(e,ti(e,t.from),ti(e,t.to),t.margin))}function Ri(e,t,n,i){t=Oi(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});Wi(e,t.scrollLeft,t.scrollTop)}function Bi(e,t){Math.abs(e.doc.scrollTop-t)<2||(g||ir(e,{top:t}),zi(e,t,!0),g&&ir(e),Qi(e,100))}function zi(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n||(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop==t)||(e.display.scroller.scrollTop=t)}function ji(e,t,n,i){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i||(e.doc.scrollLeft=t,lr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function qi(e){var t=e.display,n=t.gutters.offsetWidth,i=Math.round(e.doc.height+En(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+Hn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function _i(e,t,n){this.cm=n;var i=this.vert=M("div",[M("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=M("div",[M("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1,e(i),e(r),S(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),S(r,"scroll",function(){r.clientWidth&&t(r.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,b&&v<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function Ui(){}_i.prototype.update=function(e){var t,n=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;return i?(this.vert.style.display="block",this.vert.style.bottom=n?r+"px":"0",t=e.viewHeight-(n?r:0),this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+t)+"px"):(this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0"),n?(this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px",t=e.viewWidth-e.barLeft-(i?r:0),this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+t)+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedZeroWidth&&0<e.clientHeight&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:n?r:0}},_i.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},_i.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},_i.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=C&&!u?"12px":"18px",this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new pe,this.disableVert=new pe},_i.prototype.enableZeroWidthBar=function(n,i,r){n.style.visibility="",i.set(1e3,function e(){var t=n.getBoundingClientRect();("vert"==r?document.elementFromPoint(t.right-1,(t.top+t.bottom)/2):document.elementFromPoint((t.right+t.left)/2,t.bottom-1))!=n?n.style.visibility="hidden":i.set(1e3,e)})},_i.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};function Gi(e,t){t=t||qi(e);var n=e.display.barWidth,i=e.display.barHeight;Vi(e,t);for(var r=0;r<4&&n!=e.display.barWidth||i!=e.display.barHeight;r++)n!=e.display.barWidth&&e.options.lineWrapping&&Ai(e),Vi(e,qi(e)),n=e.display.barWidth,i=e.display.barHeight}function Vi(e,t){var n=e.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Ui.prototype.update=function(){return{bottom:0,right:0}},Ui.prototype.setScrollLeft=function(){},Ui.prototype.setScrollTop=function(){},Ui.prototype.clear=function(){};var $i={native:_i,null:Ui};function Xi(n){n.display.scrollbars&&(n.display.scrollbars.clear(),n.display.scrollbars.addClass)&&J(n.display.wrapper,n.display.scrollbars.addClass),n.display.scrollbars=new $i[n.options.scrollbarStyle](function(e){n.display.wrapper.insertBefore(e,n.display.scrollbarFiller),S(e,"mousedown",function(){n.state.focused&&setTimeout(function(){return n.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,t){("horizontal"==t?ji:Bi)(n,e)},n),n.display.scrollbars.addClass&&ie(n.display.wrapper,n.display.scrollbars.addClass)}var Ki=0;function Yi(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ki,markArrays:null},e=e.curOp,xn?xn.ops.push(e):e.ownsGroup=xn={ops:[e],delayedCallbacks:[]}}function Zi(e){e=e.curOp;if(e){var t=function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;for(var n=e.ops,i=0;i<n.length;i++){l=o=r=void 0;var r=n[i],o=r.cm,l=o.display;(function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Hn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Hn(e)+"px",t.scrollbarsClipped=!0)})(o),r.updateMaxLine&&sn(o),r.mustUpdate=r.viewChanged||r.forceUpdate||null!=r.scrollTop||r.scrollToPos&&(r.scrollToPos.from.line<l.viewFrom||r.scrollToPos.to.line>=l.viewTo)||l.maxLineChanged&&o.options.lineWrapping,r.update=r.mustUpdate&&new er(o,r.mustUpdate&&{top:r.scrollTop,ensure:r.scrollToPos},r.forceUpdate)}for(var a=0;a<n.length;a++){s=void 0;var s=n[a];s.updatedDisplay=s.mustUpdate&&tr(s.cm,s.update)}for(var c=0;c<n.length;c++){u=void 0;d=void 0;h=void 0;var u=n[c];var d=u.cm,h=d.display;u.updatedDisplay&&Ai(d);u.barMeasure=qi(d),h.maxLineChanged&&!d.options.lineWrapping&&(u.adjustWidthTo=Rn(d,h.maxLine,h.maxLine.text.length).left+3,d.display.sizerWidth=u.adjustWidthTo,u.barMeasure.scrollWidth=Math.max(h.scroller.clientWidth,h.sizer.offsetLeft+u.adjustWidthTo+Hn(d)+d.display.barWidth),u.maxScrollLeft=Math.max(0,h.sizer.offsetLeft+u.adjustWidthTo-In(d)));(u.updatedDisplay||u.selectionChanged)&&(u.preparedSelection=h.input.prepareSelection())}for(var f=0;f<n.length;f++){p=void 0;m=void 0;g=void 0;var p=n[f];var m=p.cm;null!=p.adjustWidthTo&&(m.display.sizer.style.minWidth=p.adjustWidthTo+"px",p.maxScrollLeft<m.doc.scrollLeft&&ji(m,Math.min(m.display.scroller.scrollLeft,p.maxScrollLeft),!0),m.display.maxLineChanged=!1);var g=p.focus&&p.focus==N(se(m));p.preparedSelection&&m.display.input.showSelection(p.preparedSelection,g);!p.updatedDisplay&&p.startHeight==m.doc.height||Gi(m,p.barMeasure);p.updatedDisplay&&or(m,p.barMeasure);p.selectionChanged&&Li(m);m.state.focused&&p.updateInput&&m.display.input.reset(p.typing);g&&Ti(p.cm)}for(var v,y=0;y<n.length;y++){x=void 0;b=void 0;w=void 0;C=void 0;v=void 0;k=void 0;S=void 0;L=void 0;T=void 0;var x=n[y];var b=x.cm,w=b.display,C=b.doc;x.updatedDisplay&&nr(b,x.update);null==w.wheelStartX||null==x.scrollTop&&null==x.scrollLeft&&!x.scrollToPos||(w.wheelStartX=w.wheelStartY=null);null!=x.scrollTop&&zi(b,x.scrollTop,x.forceScroll);null!=x.scrollLeft&&ji(b,x.scrollLeft,!0,!0);x.scrollToPos&&(v=function(e,t,n,i){null==i&&(i=0),e.options.lineWrapping||t!=n||(n="before"==t.sticky?O(t.line,t.ch+1,"before"):t,t=t.ch?O(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var r=0;r<5;r++){var o,l=!1,a=ei(e,t),s=n&&n!=t?ei(e,n):a,a=Oi(e,o={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-i,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+i}),s=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=a.scrollTop&&(Bi(e,a.scrollTop),1<Math.abs(e.doc.scrollTop-s))&&(l=!0),!(l=null!=a.scrollLeft&&(ji(e,a.scrollLeft),1<Math.abs(e.doc.scrollLeft-c))?!0:l))break}return o}(b,I(C,x.scrollToPos.from),I(C,x.scrollToPos.to),x.scrollToPos.margin),function(e,t){var n,i,r,o;A(e,"scrollCursorIntoView")||(o=(n=e.display).sizer.getBoundingClientRect(),i=null,r=n.wrapper.ownerDocument,t.top+o.top<0?i=!0:t.bottom+o.top>(r.defaultView.innerHeight||r.documentElement.clientHeight)&&(i=!1),null==i)||V||(o=M("div","",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Fn(e.display))+"px;\n height: "+(t.bottom-t.top+Hn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;"),e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o))}(b,v));var k=x.maybeHiddenMarkers,S=x.maybeUnhiddenMarkers;if(k)for(var L=0;L<k.length;++L)k[L].lines.length||D(k[L],"hide");if(S)for(var T=0;T<S.length;++T)S[T].lines.length&&D(S[T],"unhide");w.wrapper.offsetHeight&&(C.scrollTop=b.display.scroller.scrollTop);x.changeObjs&&D(b,"changes",b,x.changeObjs);x.update&&x.update.finish()}};if(e=e.ownsGroup)try{var n=e,i=n.delayedCallbacks,r=0;do{for(;r<i.length;r++)i[r].call(null);for(var o=0;o<n.ops.length;o++){var l=n.ops[o];if(l.cursorActivityHandlers)for(;l.cursorActivityCalled<l.cursorActivityHandlers.length;)l.cursorActivityHandlers[l.cursorActivityCalled++].call(null,l.cm)}}while(r<i.length)}finally{xn=null,t(e)}}}function d(e,t){if(e.curOp)return t();Yi(e);try{return t()}finally{Zi(e)}}function P(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Yi(e);try{return t.apply(e,arguments)}finally{Zi(e)}}}function n(e){return function(){if(this.curOp)return e.apply(this,arguments);Yi(this);try{return e.apply(this,arguments)}finally{Zi(this)}}}function i(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Yi(e);try{return t.apply(this,arguments)}finally{Zi(e)}}}function Qi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,de(Ji,e))}function Ji(l){var a,s,c,u=l.doc;u.highlightFrontier>=l.display.viewTo||(a=+new Date+l.options.workTime,s=Et(l,u.highlightFrontier),c=[],u.iter(s.line,Math.min(u.first+u.size,l.display.viewTo+500),function(e){if(s.line>=l.display.viewFrom){for(var t=e.styles,n=e.text.length>l.options.maxHighlightLength?ft(u.mode,s.state):null,i=At(l,e,s,!0),n=(n&&(s.state=n),e.styles=i.styles,e.styleClasses),i=i.classes,r=(i?e.styleClasses=i:n&&(e.styleClasses=null),!t||t.length!=e.styles.length||n!=i&&(!n||!i||n.bgClass!=i.bgClass||n.textClass!=i.textClass)),o=0;!r&&o<t.length;++o)r=t[o]!=e.styles[o];r&&c.push(s.line),e.stateAfter=s.save()}else e.text.length<=l.options.maxHighlightLength&&Ot(l,e.text,s),e.stateAfter=s.line%5==0?s.save():null;if(s.nextLine(),+new Date>a)return Qi(l,l.options.workDelay),!0}),u.highlightFrontier=s.line,u.modeFrontier=Math.max(u.modeFrontier,s.line),c.length&&d(l,function(){for(var e=0;e<c.length;e++)vi(l,c[e],"text")}))}var er=function(e,t,n){var i=e.display;this.viewport=t,this.visible=Ei(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=In(e),this.force=n,this.dims=di(e),this.events=[]};function tr(e,t){var n=e.display,i=e.doc;if(t.editorIsHidden)return yi(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==bi(e))return!1;ar(e)&&(yi(e),t.dims=di(e));var r=i.first+i.size,o=Math.max(t.visible.from-e.options.viewportMargin,i.first),l=Math.min(r,t.visible.to+e.options.viewportMargin),i=(n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(i.first,n.viewFrom)),n.viewTo>l&&n.viewTo-l<20&&(l=Math.min(r,n.viewTo)),jt&&(o=nn(e.doc,o),l=rn(e.doc,l)),o!=n.viewFrom||l!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth),r=(r=o,o=l,0==(a=(l=e).display).view.length||r>=a.viewTo||o<=a.viewFrom?(a.view=yn(l,r,o),a.viewFrom=r):(a.viewFrom>r?a.view=yn(l,r,a.viewFrom).concat(a.view):a.viewFrom<r&&(a.view=a.view.slice(gi(l,r))),a.viewFrom=r,a.viewTo<o?a.view=a.view.concat(yn(l,a.viewTo,o)):a.viewTo>o&&(a.view=a.view.slice(0,gi(l,o)))),a.viewTo=o,n.viewOffset=ln(F(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px",bi(e));if(!i&&0==r&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var a,l=!(l=e).hasFocus()&&(a=N(se(l)))&&ne(l.display.lineDiv,a)?(a={activeElt:a},window.getSelection&&(o=ue(l).getSelection()).anchorNode&&o.extend&&ne(l.display.lineDiv,o.anchorNode)&&(a.anchorNode=o.anchorNode,a.anchorOffset=o.anchorOffset,a.focusNode=o.focusNode,a.focusOffset=o.focusOffset),a):null,s=(4<r&&(n.lineDiv.style.display="none"),e),c=n.updateLineNumbers,u=t.dims,o=s.display,d=s.options.lineNumbers,h=o.lineDiv,f=h.firstChild;function p(e){var t=e.nextSibling;return w&&C&&s.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var m=o.view,g=o.viewFrom,v=0;v<m.length;v++){var y=m[v];if(!y.hidden)if(y.node&&y.node.parentNode==h){for(;f!=y.node;)f=p(f);var x=d&&null!=c&&c<=g&&y.lineNumber;y.changes&&(-1<k(y.changes,"gutter")&&(x=!1),Cn(s,y,g,u)),x&&(ee(y.lineNumber),y.lineNumber.appendChild(document.createTextNode(wt(s.options,g)))),f=y.node.nextSibling}else{x=function(e,t,n,i){var r=Sn(e,t);return t.text=t.node=r.pre,r.bgClass&&(t.bgClass=r.bgClass),r.textClass&&(t.textClass=r.textClass),Ln(e,t),Tn(e,t,n,i),Mn(e,t,i),t.node}(s,y,g,u);h.insertBefore(x,f)}g+=y.size}for(;f;)f=p(f);return 4<r&&(n.lineDiv.style.display=""),n.renderedView=n.view,(a=l)&&a.activeElt&&a.activeElt!=N(ce(a.activeElt))&&(a.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(a.activeElt.nodeName))&&a.anchorNode&&ne(document.body,a.anchorNode)&&ne(document.body,a.focusNode)&&(r=(o=a.activeElt.ownerDocument).defaultView.getSelection(),(o=o.createRange()).setEnd(a.anchorNode,a.anchorOffset),o.collapse(!1),r.removeAllRanges(),r.addRange(o),r.extend(a.focusNode,a.focusOffset)),ee(n.cursorDiv),ee(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,i&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Qi(e,400)),!(n.updateLineNumbers=null)}function nr(e,t){for(var n=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=In(e))i&&(t.visible=Ei(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+En(e.display)-Wn(e),n.top)}),t.visible=Ei(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!tr(e,t))break;Ai(e);var r=qi(e);wi(e),Gi(e,r),or(e,r),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ir(e,t){var n,t=new er(e,t);tr(e,t)&&(Ai(e),nr(e,t),n=qi(e),wi(e),Gi(e,n),or(e,n),t.finish())}function rr(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",x(e,"gutterChanged",e)}function or(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+Hn(e)+"px"}function lr(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var i=hi(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,o=i+"px",l=0;l<n.length;l++)if(!n[l].hidden){e.options.fixedGutter&&(n[l].gutter&&(n[l].gutter.style.left=o),n[l].gutterBackground)&&(n[l].gutterBackground.style.left=o);var a=n[l].alignable;if(a)for(var s=0;s<a.length;s++)a[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=i+r+"px")}}function ar(e){var t,n,i,r;if(e.options.lineNumbers)return t=e.doc,t=wt(e.options,t.first+t.size-1),n=e.display,t.length!=n.lineNumChars?(i=(r=n.measure.appendChild(M("div",[M("div",t)],"CodeMirror-linenumber CodeMirror-gutter-elt"))).firstChild.offsetWidth,r=r.offsetWidth-i,n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(i,n.lineGutter.offsetWidth-r)+1,n.lineNumWidth=n.lineNumInnerWidth+r,n.lineNumChars=n.lineNumInnerWidth?t.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",rr(e.display),1):void 0}function sr(e,t){for(var n=[],i=!1,r=0;r<e.length;r++){var o=e[r],l=null;if("string"!=typeof o&&(l=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;i=!0}n.push({className:o,style:l})}return t&&!i&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function cr(e){var t=e.gutters,n=e.gutterSpecs;ee(t),e.lineGutter=null;for(var i=0;i<n.length;++i){var r=n[i],o=r.className,r=r.style,l=t.appendChild(M("div",null,"CodeMirror-gutter "+o));r&&(l.style.cssText=r),"CodeMirror-linenumbers"==o&&((e.lineGutter=l).style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",rr(e)}function ur(e){cr(e.display),W(e),lr(e)}function dr(e,t,n,i){var r=this,o=(this.input=n,r.scrollbarFiller=M("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=M("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=te("div",null,"CodeMirror-code"),r.selectionDiv=M("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=M("div",null,"CodeMirror-cursors"),r.measure=M("div",null,"CodeMirror-measure"),r.lineMeasure=M("div",null,"CodeMirror-measure"),r.lineSpace=te("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none"),te("div",[r.lineSpace],"CodeMirror-lines"));r.mover=M("div",[o],null,"position: relative"),r.sizer=M("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=M("div",null,null,"position: absolute; height: "+me+"px; width: 1px;"),r.gutters=M("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=M("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=M("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),q&&105<=_&&(r.wrapper.style.clipPath="inset(0px)"),r.wrapper.setAttribute("translate","no"),b&&v<8&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),w||g&&X||(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,r.gutterSpecs=sr(i.gutters,i.lineNumbers),cr(r),n.init(r)}er.prototype.signal=function(e,t){$e(e,t)&&this.events.push(arguments)},er.prototype.finish=function(){for(var e=0;e<this.events.length;e++)D.apply(null,this.events[e])};var hr=0,fr=null;function pr(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function mr(e){e=pr(e);return e.x*=fr,e.y*=fr,e}function gr(e,t){q&&102==_&&(null==e.display.chromeScrollHack?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var n,i,r=pr(t),o=r.x,r=r.y,l=fr,a=(0===t.deltaMode&&(o=t.deltaX,r=t.deltaY,l=1),e.display),s=a.scroller,c=s.scrollWidth>s.clientWidth,u=s.scrollHeight>s.clientHeight;if(o&&c||r&&u){if(r&&C&&w)e:for(var d=t.target,h=a.view;d!=s;d=d.parentNode)for(var f=0;f<h.length;f++)if(h[f].node==d){e.display.currentWheelTarget=d;break e}!o||g||U||null==l?(r&&null!=l&&(i=(c=e.doc.scrollTop)+a.wrapper.clientHeight,(n=r*l)<0?c=Math.max(0,c+n-50):i=Math.min(e.doc.height,i+n+50),ir(e,{top:c,bottom:i})),hr<20&&0!==t.deltaMode&&(null==a.wheelStartX?(a.wheelStartX=s.scrollLeft,a.wheelStartY=s.scrollTop,a.wheelDX=o,a.wheelDY=r,setTimeout(function(){var e,t;null!=a.wheelStartX&&(e=s.scrollLeft-a.wheelStartX,t=(t=s.scrollTop-a.wheelStartY)&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX,a.wheelStartX=a.wheelStartY=null,t)&&(fr=(fr*hr+t)/(hr+1),++hr)},200)):(a.wheelDX+=o,a.wheelDY+=r))):(r&&u&&Bi(e,Math.max(0,s.scrollTop+r*l)),ji(e,Math.max(0,s.scrollLeft+o*l)),r&&!u||T(t),a.wheelStartX=null)}}b?fr=-.53:g?fr=15:q?fr=-.7:G&&(fr=-1/3);var B=function(e,t){this.ranges=e,this.primIndex=t},z=(B.prototype.primary=function(){return this.ranges[this.primIndex]},B.prototype.equals=function(e){if(e!=this){if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],i=e.ranges[t];if(!Ct(n.anchor,i.anchor)||!Ct(n.head,i.head))return!1}}return!0},B.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new z(kt(this.ranges[t].anchor),kt(this.ranges[t].head));return new B(e,this.primIndex)},B.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},B.prototype.contains=function(e,t){t=t||e;for(var n=0;n<this.ranges.length;n++){var i=this.ranges[n];if(0<=H(t,i.from())&&H(e,i.to())<=0)return n}return-1},function(e,t){this.anchor=e,this.head=t});function vr(e,t,n){var i=e&&e.options.selectionsMayTouch,e=t[n];t.sort(function(e,t){return H(e.from(),t.from())}),n=k(t,e);for(var r=1;r<t.length;r++){var o,l=t[r],a=t[r-1],s=H(a.to(),l.from());(i&&!l.empty()?0<s:0<=s)&&(s=Lt(a.from(),l.from()),o=St(a.to(),l.to()),l=a.empty()?l.from()==l.head:a.from()==a.head,r<=n&&--n,t.splice(--r,2,new z(l?o:s,l?s:o)))}return new B(t,n)}function yr(e,t){return new B([new z(e,t||e)],0)}function xr(e){return e.text?O(e.from.line+e.text.length-1,R(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function br(e,t){var n,i;return H(e,t.from)<0?e:H(e,t.to)<=0?xr(t):(n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch,e.line==t.to.line&&(i+=xr(t).ch-t.to.ch),O(n,i))}function wr(e,t){for(var n=[],i=0;i<e.sel.ranges.length;i++){var r=e.sel.ranges[i];n.push(new z(br(r.anchor,t),br(r.head,t)))}return vr(e.cm,n,e.sel.primIndex)}function Cr(e,t,n){return e.line==t.line?O(n.line,e.ch-t.ch+n.ch):O(n.line+(e.line-t.line),e.ch)}function kr(e){e.doc.mode=ut(e.options,e.doc.modeOption),Sr(e)}function Sr(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,Qi(e,100),e.state.modeGen++,e.curOp&&W(e)}function Lr(e,t){return 0==t.from.ch&&0==t.to.ch&&""==R(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Tr(e,o,t,l){function r(e){return t?t[e]:null}function n(e,t,n){var i,r;t=t,n=n,r=l,(i=e).text=t,i.stateAfter&&(i.stateAfter=null),i.styles&&(i.styles=null),null!=i.order&&(i.order=null),Vt(i),$t(i,n),(t=r?r(i):1)!=i.height&&yt(i,t),x(e,"change",e,o)}function i(e,t){for(var n=[],i=e;i<t;++i)n.push(new cn(u[i],r(i),l));return n}var a,s=o.from,c=o.to,u=o.text,d=F(e,s.line),h=F(e,c.line),f=R(u),p=r(u.length-1),m=c.line-s.line;o.full?(e.insert(0,i(0,u.length)),e.remove(u.length,e.size-u.length)):Lr(e,o)?(a=i(0,u.length-1),n(h,h.text,p),m&&e.remove(s.line,m),a.length&&e.insert(s.line,a)):d==h?1==u.length?n(d,d.text.slice(0,s.ch)+f+d.text.slice(c.ch),p):((a=i(1,u.length-1)).push(new cn(f+d.text.slice(c.ch),p,l)),n(d,d.text.slice(0,s.ch)+u[0],r(0)),e.insert(s.line+1,a)):1==u.length?(n(d,d.text.slice(0,s.ch)+u[0]+h.text.slice(c.ch),r(0)),e.remove(s.line+1,m)):(n(d,d.text.slice(0,s.ch)+u[0],r(0)),n(h,f+h.text.slice(c.ch),p),a=i(1,u.length-1),1<m&&e.remove(s.line+1,m-1),e.insert(s.line+1,a)),x(e,"change",e,o)}function Mr(e,a,s){!function e(t,n,i){if(t.linked)for(var r=0;r<t.linked.length;++r){var o,l=t.linked[r];l.doc!=n&&(o=i&&l.sharedHist,!s||o)&&(a(l.doc,o),e(l.doc,t,o))}}(e,null,!0)}function Nr(e,t){if(t.cm)throw new Error("This document is already in use.");pi((e.doc=t).cm=e),kr(e),Dr(e),e.options.direction=t.direction,e.options.lineWrapping||sn(e),e.options.mode=t.modeOption,W(e)}function Dr(e){("rtl"==e.doc.direction?ie:J)(e.display.lineDiv,"CodeMirror-rtl")}function Ar(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function Fr(e,t){var n={from:kt(t.from),to:xr(t),text:gt(e,t.from,t.to)};return Wr(e,n,t.from.line,t.to.line+1),Mr(e,function(e){return Wr(e,n,t.from.line,t.to.line+1)},!0),n}function Er(e){for(;e.length;){if(!R(e).ranges)break;e.pop()}}function Or(e,t,n,i){var r,o,l=e.history,a=(l.undone.length=0,+new Date);if((l.lastOp==i||l.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&l.lastModTime>a-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=(o=l).lastOp==i?(Er(o.done),R(o.done)):o.done.length&&!R(o.done).ranges?R(o.done):1<o.done.length&&!o.done[o.done.length-2].ranges?(o.done.pop(),R(o.done)):void 0))r=R(o.changes),0==H(t.from,t.to)&&0==H(t.from,r.to)?r.to=xr(t):o.changes.push(Fr(e,t));else{var s=R(l.done);for(s&&s.ranges||Ir(e.sel,l.done),o={changes:[Fr(e,t)],generation:l.generation},l.done.push(o);l.done.length>l.undoDepth;)l.done.shift(),l.done[0].ranges||l.done.shift()}l.done.push(n),l.generation=++l.maxGeneration,l.lastModTime=l.lastSelTime=a,l.lastOp=l.lastSelOp=i,l.lastOrigin=l.lastSelOrigin=t.origin,r||D(e,"historyAdded")}function Hr(e,t,n,i){var r,o,l,a=e.history,s=i&&i.origin;n==a.lastSelOp||s&&a.lastSelOrigin==s&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==s||(e=e,r=s,o=R(a.done),l=t,"*"==(r=r.charAt(0)))||"+"==r&&o.ranges.length==l.ranges.length&&o.somethingSelected()==l.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500))?a.done[a.done.length-1]=t:Ir(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=s,a.lastSelOp=n,i&&!1!==i.clearRedo&&Er(a.undone)}function Ir(e,t){var n=R(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wr(t,n,e,i){var r=n["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,i),function(e){e.markedSpans&&((r=r||(n["spans_"+t.id]={}))[o]=e.markedSpans),++o})}function Pr(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var i=[],r=0;r<t.text.length;++r)i.push(function(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t=t||e.slice(0,n):t&&t.push(e[n]);return t?t.length?t:null:e}(n[r]));return i}function Rr(e,t){var n=Pr(e,t),i=Ut(e,t);if(!n)return i;if(i)for(var r=0;r<n.length;++r){var o=n[r],l=i[r];if(o&&l)e:for(var a=0;a<l.length;++a){for(var s=l[a],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else l&&(n[r]=l)}return n}function Br(e,t,n){for(var i=[],r=0;r<e.length;++r){var o=e[r];if(o.ranges)i.push(n?B.prototype.deepCopy.call(o):o);else{var l=o.changes,a=[];i.push({changes:a});for(var s=0;s<l.length;++s){var c,u=l[s];if(a.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&-1<k(t,Number(c[1]))&&(R(a)[d]=u[d],delete u[d])}}}return i}function zr(e,t,n,i){return i?(i=e.anchor,n&&((e=H(t,i)<0)!=H(n,i)<0?(i=t,t=n):e!=H(t,n)<0&&(t=n)),new z(i,t)):new z(n||t,t)}function jr(e,t,n,i,r){null==r&&(r=e.cm&&(e.cm.display.shift||e.extend)),j(e,new B([zr(e.sel.primary(),t,n,r)],0),i)}function qr(e,t,n){for(var i=[],r=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)i[o]=zr(e.sel.ranges[o],t[o],null,r);j(e,vr(e.cm,i,e.sel.primIndex),n)}function _r(e,t,n,i){var r=e.sel.ranges.slice(0);r[t]=n,j(e,vr(e.cm,r,e.sel.primIndex),i)}function Ur(e,t,n,i){j(e,yr(t,n),i)}function Gr(e,t,n){var i=e.history.done,r=R(i);r&&r.ranges?Vr(e,i[i.length-1]=t,n):j(e,t,n)}function j(e,t,n){Vr(e,t,n),Hr(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Vr(e,t,n){($e(e,"beforeSelectionChange")||e.cm&&$e(e.cm,"beforeSelectionChange"))&&(i=e,o=n,o={ranges:(r=t).ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new z(I(i,e[t].anchor),I(i,e[t].head))},origin:o&&o.origin},D(i,"beforeSelectionChange",i,o),i.cm&&D(i.cm,"beforeSelectionChange",i.cm,o),t=o.ranges!=r.ranges?vr(i.cm,o.ranges,o.ranges.length-1):r);var i,r,o=n&&n.bias||(H(t.primary().head,e.sel.primary().head)<0?-1:1);$r(e,Kr(e,t,o,!0)),n&&!1===n.scroll||!e.cm||"nocursor"==e.cm.getOption("readOnly")||Ii(e.cm)}function $r(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ve(e.cm)),x(e,"cursorActivity",e))}function Xr(e){$r(e,Kr(e,e.sel,null,!1))}function Kr(e,t,n,i){for(var r,o=0;o<t.ranges.length;o++){var l=t.ranges[o],a=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=Zr(e,l.anchor,a&&a.anchor,n,i),a=l.head==l.anchor?s:Zr(e,l.head,a&&a.head,n,i);!r&&s==l.anchor&&a==l.head||((r=r||t.ranges.slice(0,o))[o]=new z(s,a))}return r?vr(e.cm,r,t.primIndex):t}function Yr(e,t,n,i,r){var o=F(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var a=o.markedSpans[l],s=a.marker,c="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,u="selectRight"in s?!s.selectRight:s.inclusiveRight;if((null==a.from||(c?a.from<=t.ch:a.from<t.ch))&&(null==a.to||(u?a.to>=t.ch:a.to>t.ch))){if(r&&(D(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(s.atomic){if(n){var a=s.find(i<0?1:-1),d=void 0;if((a=(i<0?u:c)?Qr(e,a,-i,a&&a.line==t.line?o:null):a)&&a.line==t.line&&(d=H(a,n))&&(i<0?d<0:0<d))return Yr(e,a,t,i,r)}d=s.find(i<0?-1:1);return(d=(i<0?c:u)?Qr(e,d,i,d.line==t.line?o:null):d)?Yr(e,d,t,i,r):null}}}return t}function Zr(e,t,n,i,r){i=i||1,r=Yr(e,t,n,i,r)||!r&&Yr(e,t,n,i,!0)||Yr(e,t,n,-i,r)||!r&&Yr(e,t,n,-i,!0);return r||(e.cantEdit=!0,O(e.first,0))}function Qr(e,t,n,i){return n<0&&0==t.ch?t.line>e.first?I(e,O(t.line-1)):null:0<n&&t.ch==(i||F(e,t.line)).text.length?t.line<e.first+e.size-1?O(t.line+1,0):null:new O(t.line,t.ch+n)}function Jr(e){e.setSelection(O(e.firstLine(),0),O(e.lastLine()),ve)}function eo(r,e,t){var o={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return o.canceled=!0}};return t&&(o.update=function(e,t,n,i){e&&(o.from=I(r,e)),t&&(o.to=I(r,t)),n&&(o.text=n),void 0!==i&&(o.origin=i)}),D(r,"beforeChange",r,o),r.cm&&D(r.cm,"beforeChange",r.cm,o),o.canceled?(r.cm&&(r.cm.curOp.updateInput=2),null):{from:o.from,to:o.to,text:o.text,origin:o.origin}}function to(e,t,n){if(e.cm){if(!e.cm.curOp)return P(e.cm,to)(e,t,n);if(e.cm.state.suppressEdits)return}if(!($e(e,"beforeChange")||e.cm&&$e(e.cm,"beforeChange"))||(t=eo(e,t,!0))){var i=zt&&!n&&function(e,t,n){var i=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||i&&-1!=k(i,n)||(i=i||[]).push(n)}}),!i)return null;for(var r=[{from:t,to:n}],o=0;o<i.length;++o)for(var l=i[o],a=l.find(0),s=0;s<r.length;++s){var c,u,d,h=r[s];H(h.to,a.from)<0||0<H(h.from,a.to)||(c=[s,1],u=H(h.from,a.from),d=H(h.to,a.to),(u<0||!l.inclusiveLeft&&!u)&&c.push({from:h.from,to:a.from}),(0<d||!l.inclusiveRight&&!d)&&c.push({from:a.to,to:h.to}),r.splice.apply(r,c),s+=c.length-3)}return r}(e,t.from,t.to);if(i)for(var r=i.length-1;0<=r;--r)no(e,{from:i[r].from,to:i[r].to,text:r?[""]:t.text,origin:t.origin});else no(e,t)}}function no(e,n){var t,i;1==n.text.length&&""==n.text[0]&&0==H(n.from,n.to)||(t=wr(e,n),Or(e,n,t,e.cm?e.cm.curOp.id:NaN),oo(e,n,t,Ut(e,n)),i=[],Mr(e,function(e,t){t||-1!=k(i,e.history)||(co(e.history,n),i.push(e.history)),oo(e,n,null,Ut(e,n))}))}function io(r,o,e){var t=r.cm&&r.cm.state.suppressEdits;if(!t||e){for(var l,n=r.history,i=r.sel,a="undo"==o?n.done:n.undone,s="undo"==o?n.undone:n.done,c=0;c<a.length&&(l=a[c],e?!l.ranges||l.equals(r.sel):l.ranges);c++);if(c!=a.length){for(n.lastOrigin=n.lastSelOrigin=null;;){if(!(l=a.pop()).ranges){if(t)return void a.push(l);break}if(Ir(l,s),e&&!l.equals(r.sel))return void j(r,l,{clearRedo:!1});i=l}for(var u=[],d=(Ir(i,s),s.push({changes:u,generation:n.generation}),n.generation=l.generation||++n.maxGeneration,$e(r,"beforeChange")||r.cm&&$e(r.cm,"beforeChange")),h=l.changes.length-1;0<=h;--h){var f=function(e){var n=l.changes[e];if(n.origin=o,d&&!eo(r,n,!1))return a.length=0,{};u.push(Fr(r,n));var t=e?wr(r,n):R(a),i=(oo(r,n,t,Rr(r,n)),!e&&r.cm&&r.cm.scrollIntoView({from:n.from,to:xr(n)}),[]);Mr(r,function(e,t){t||-1!=k(i,e.history)||(co(e.history,n),i.push(e.history)),oo(e,n,null,Rr(e,n))})}(h);if(f)return f.v}}}}function ro(e,t){if(0!=t&&(e.first+=t,e.sel=new B(ke(e.sel.ranges,function(e){return new z(O(e.anchor.line+t,e.anchor.ch),O(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){W(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;i<n.viewTo;i++)vi(e.cm,i,"gutter")}}function oo(e,t,n,i){if(e.cm&&!e.cm.curOp)return P(e.cm,oo)(e,t,n,i);if(t.to.line<e.first)ro(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){t.from.line<e.first&&(ro(e,r=t.text.length-1-(e.first-t.from.line)),t={from:O(e.first,0),to:O(t.to.line+r,t.to.ch),text:[R(t.text)],origin:t.origin});var r=e.lastLine();if((t=t.to.line>r?{from:t.from,to:O(r,F(e,r).text.length),text:[t.text[0]],origin:t.origin}:t).removed=gt(e,t.from,t.to),n=n||wr(e,t),e.cm){var r=e.cm,o=t,l=i,a=r.doc,s=r.display,c=o.from,u=o.to,d=!1,h=c.line,f=(r.options.lineWrapping||(h=E(tn(F(a,c.line))),a.iter(h,u.line+1,function(e){if(e==s.maxLine)return d=!0})),-1<a.sel.contains(o.from,o.to)&&Ve(r),Tr(a,o,l,fi(r)),r.options.lineWrapping||(a.iter(h,c.line+o.text.length,function(e){var t=an(e);t>s.maxLineLength&&(s.maxLine=e,s.maxLineLength=t,s.maxLineChanged=!0,d=!1)}),d&&(r.curOp.updateMaxLine=!0)),a),p=c.line;if(f.modeFrontier=Math.min(f.modeFrontier,p),!(f.highlightFrontier<p-10)){for(var m=f.first,g=p-1;m<g;g--){var v=F(f,g).stateAfter;if(v&&(!(v instanceof Nt)||g+v.lookAhead<p)){m=g+1;break}}f.highlightFrontier=Math.min(f.highlightFrontier,m)}Qi(r,400),l=o.text.length-(u.line-c.line)-1,o.full?W(r):c.line!=u.line||1!=o.text.length||Lr(r.doc,o)?W(r,c.line,u.line+1,l):vi(r,c.line,"text"),h=$e(r,"changes"),((a=$e(r,"change"))||h)&&(l={from:c,to:u,text:o.text,removed:o.removed,origin:o.origin},a&&x(r,"change",r,l),h)&&(r.curOp.changeObjs||(r.curOp.changeObjs=[])).push(l),r.display.selForContextMenu=null}else Tr(e,t,i);Vr(e,n,ve),e.cantEdit&&Zr(e,O(e.firstLine(),0))&&(e.cantEdit=!1)}}function lo(e,t,n,i,r){var o;H(i=i||n,n)<0&&(n=(o=[i,n])[0],i=o[1]),"string"==typeof t&&(t=e.splitLines(t)),to(e,{from:n,to:i,text:t,origin:r})}function ao(e,t,n,i){n<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function so(e,t,n,i){for(var r=0;r<e.length;++r){var o=e[r],l=!0;if(o.ranges){o.copied||((o=e[r]=o.deepCopy()).copied=!0);for(var a=0;a<o.ranges.length;a++)ao(o.ranges[a].anchor,t,n,i),ao(o.ranges[a].head,t,n,i)}else{for(var s=0;s<o.changes.length;++s){var c=o.changes[s];if(n<c.from.line)c.from=O(c.from.line+i,c.from.ch),c.to=O(c.to.line+i,c.to.ch);else if(t<=c.to.line){l=!1;break}}l||(e.splice(0,r+1),r=0)}}}function co(e,t){var n=t.from.line,i=t.to.line,t=t.text.length-(i-n)-1;so(e.done,n,i,t),so(e.undone,n,i,t)}function uo(e,t,n,i){var r=t,o=t;return"number"==typeof t?o=F(e,Tt(e,t)):r=E(t),null==r?null:(i(o,r)&&e.cm&&vi(e.cm,r,n),o)}function ho(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}function fo(e){this.children=e;for(var t=0,n=0,i=0;i<e.length;++i){var r=e[i];t+=r.chunkSize(),n+=r.height,r.parent=this}this.size=t,this.height=n,this.parent=null}z.prototype.from=function(){return Lt(this.anchor,this.head)},z.prototype.to=function(){return St(this.anchor,this.head)},z.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},ho.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n,i=e,r=e+t;i<r;++i){var o=this.lines[i];this.height-=o.height,(n=o).parent=null,Vt(n),x(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,n){for(var i=e+t;e<i;++e)if(n(this.lines[e]))return!0}},fo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n,i=0;i<this.children.length;++i){var r=this.children[i],o=r.chunkSize();if(e<o){var l=Math.min(t,o-e),a=r.height;if(r.removeInner(e,l),this.height-=a-r.height,o==l&&(this.children.splice(i--,1),r.parent=null),0==(t-=l))break;e=0}else e-=o}this.size-t<25&&(1<this.children.length||!(this.children[0]instanceof ho))&&(this.collapse(n=[]),this.children=[new ho(n)],this.children[0].parent=this)},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var i=0;i<this.children.length;++i){var r=this.children[i],o=r.chunkSize();if(e<=o){if(r.insertInner(e,t,n),r.lines&&50<r.lines.length){for(var l=r.lines.length%25+25,a=l;a<r.lines.length;){var s=new ho(r.lines.slice(a,a+=25));r.height-=s.height,this.children.splice(++i,0,s),s.parent=this}r.lines=r.lines.slice(0,l),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t,n=new fo(e.children.splice(e.children.length-5,5))}while(e.parent?(e.size-=n.size,e.height-=n.height,t=k(e.parent.children,e),e.parent.children.splice(t+1,0,n)):(((t=new fo(e.children)).parent=e).children=[t,n],e=t),n.parent=e.parent,10<e.children.length);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var i=0;i<this.children.length;++i){var r=this.children[i],o=r.chunkSize();if(e<o){var l=Math.min(t,o-e);if(r.iterN(e,l,n))return!0;if(0==(t-=l))break;e=0}else e-=o}}};function po(e,t,n){if(n)for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);this.doc=e,this.node=t}function mo(e,t,n){ln(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Hi(e,n)}po.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,i=E(n);if(null!=i&&t){for(var r=0;r<t.length;++r)t[r]==this&&t.splice(r--,1);t.length||(n.widgets=null);var o=Dn(this);yt(n,Math.max(0,n.height-o)),e&&(d(e,function(){mo(e,n,-o),vi(e,i,"widget")}),x(e,"lineWidgetCleared",e,this,i))}},po.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,i=this.line,r=(this.height=null,Dn(this)-t);r&&(on(this.doc,i)||yt(i,i.height+r),n)&&d(n,function(){n.curOp.forceUpdate=!0,mo(n,i,r),x(n,"lineWidgetChanged",n,e,E(i))})},Xe(po);function go(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++vo}var vo=0;function yo(i,r,o,e,t){if(e&&e.shared)return f=i,n=r,l=o,s=t,(a=he(a=e)).shared=!1,c=[yo(f,n,l,a,s)],u=c[0],d=a.widgetNode,Mr(f,function(e){d&&(a.widgetNode=d.cloneNode(!0)),c.push(yo(e,I(e,n),I(e,l),a,s));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;u=R(c)}),new xo(c,u);var n,l,a,s,c,u,d;if(i.cm&&!i.cm.curOp)return P(i.cm,yo)(i,r,o,e,t);var h=new go(i,t),f=H(r,o);if(e&&he(e,h,!1),!(0<f||0==f&&!1!==h.clearWhenEmpty)){if(h.replacedWith&&(h.collapsed=!0,h.widgetNode=te("span",[h.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||h.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft)&&(h.widgetNode.insertLeft=!0),h.collapsed){if(en(i,r.line,r,o,h)||r.line!=o.line&&en(i,o.line,r,o,h))throw new Error("Inserting collapsed marker partially overlapping an existing one");jt=!0}h.addToHistory&&Or(i,{from:r,to:o,origin:"markText"},i.sel,NaN);var p,m=r.line,g=i.cm;if(i.iter(m,o.line+1,function(e){var t,n;g&&h.collapsed&&!g.options.lineWrapping&&tn(e)==g.display.maxLine&&(p=!0),h.collapsed&&m!=r.line&&yt(e,0),e=e,t=new qt(h,m==r.line?r.ch:null,m==o.line?o.ch:null),(n=(n=i.cm&&i.cm.curOp)&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet)))&&e.markedSpans&&n.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],n&&n.add(e.markedSpans)),t.marker.attachLine(e),++m}),h.collapsed&&i.iter(r.line,o.line+1,function(e){on(i,e)&&yt(e,0)}),h.clearOnEnter&&S(h,"beforeCursorEnter",function(){return h.clear()}),h.readOnly&&(zt=!0,i.history.done.length||i.history.undone.length)&&i.clearHistory(),h.collapsed&&(h.id=++vo,h.atomic=!0),g){if(p&&(g.curOp.updateMaxLine=!0),h.collapsed)W(g,r.line,o.line+1);else if(h.className||h.startStyle||h.endStyle||h.css||h.attributes||h.title)for(var v=r.line;v<=o.line;v++)vi(g,v,"text");h.atomic&&Xr(g.doc),x(g,"markerAdded",g,h)}}return h}go.prototype.clear=function(){if(!this.explicitlyCleared){for(var e,t=this.doc.cm,n=t&&!t.curOp,i=(n&&Yi(t),$e(this,"clear")&&(e=this.find())&&x(this,"clear",e.from,e.to),null),r=null,o=0;o<this.lines.length;++o){var l=this.lines[o],a=_t(l.markedSpans,this);t&&!this.collapsed?vi(t,E(l),"text"):t&&(null!=a.to&&(r=E(l)),null!=a.from)&&(i=E(l)),l.markedSpans=function(e,t){for(var n,i=0;i<e.length;++i)e[i]!=t&&(n=n||[]).push(e[i]);return n}(l.markedSpans,a),null==a.from&&this.collapsed&&!on(this.doc,l)&&t&&yt(l,ci(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var c=tn(this.lines[s]),u=an(c);u>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&W(t,i,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t)&&Xr(t.doc),t&&x(t,"markerCleared",t,this,i,r),n&&Zi(t),this.parent&&this.parent.clear()}},go.prototype.find=function(e,t){var n,i;null==e&&"bookmark"==this.type&&(e=1);for(var r=0;r<this.lines.length;++r){var o=this.lines[r],l=_t(o.markedSpans,this);if(null!=l.from&&(n=O(t?o:E(o),l.from),-1==e))return n;if(null!=l.to&&(i=O(t?o:E(o),l.to),1==e))return i}return n&&{from:n,to:i}},go.prototype.changed=function(){var n=this,i=this.find(-1,!0),r=this,o=this.doc.cm;i&&o&&d(o,function(){var e=i.line,t=E(i.line),t=Bn(o,t);t&&(Gn(t),o.curOp.selectionChanged=o.curOp.forceUpdate=!0),o.curOp.updateMaxLine=!0,!on(r.doc,e)&&null!=r.height&&(t=r.height,r.height=null,t=Dn(r)-t)&&yt(e,e.height+t),x(o,"markerChanged",o,n)})},go.prototype.attachLine=function(e){var t;this.lines.length||!this.doc.cm||(t=this.doc.cm.curOp).maybeHiddenMarkers&&-1!=k(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this),this.lines.push(e)},go.prototype.detachLine=function(e){this.lines.splice(k(this.lines,e),1),!this.lines.length&&this.doc.cm&&((e=this.doc.cm.curOp).maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)},Xe(go);var xo=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function bo(e){return e.findMarks(O(e.first,0),e.clipPos(O(e.lastLine())),function(e){return e.parent})}function wo(o){for(var e=0;e<o.length;e++)!function(e){var t=o[e],n=[t.primary.doc];Mr(t.primary.doc,function(e){return n.push(e)});for(var i=0;i<t.markers.length;i++){var r=t.markers[i];-1==k(n,r.doc)&&(r.parent=null,t.markers.splice(i--,1))}}(e)}xo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();x(this,"clear")}},xo.prototype.find=function(e,t){return this.primary.find(e,t)},Xe(xo);function f(e,t,n,i,r){if(!(this instanceof f))return new f(e,t,n,i,r);null==n&&(n=0),fo.call(this,[new ho([new cn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,n=O(this.modeFrontier=this.highlightFrontier=n,0),this.sel=yr(n),this.history=new Ar(null),this.id=++Co,this.modeOption=t,this.lineSep=i,this.direction="rtl"==r?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Tr(this,{from:n,to:n,text:e}),j(this,yr(n),ve)}var Co=0,ko=((f.prototype=Le(fo.prototype,{constructor:f,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,i=0;i<t.length;++i)n+=t[i].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=vt(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:i(function(e){var t=O(this.first,0),n=this.first+this.size-1;to(this,{from:t,to:O(n,F(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Wi(this.cm,0,0),j(this,yr(t),ve)}),replaceRange:function(e,t,n,i){lo(this,e,t=I(this,t),n=n?I(this,n):t,i)},getRange:function(e,t,n){e=gt(this,I(this,e),I(this,t));return!1===n?e:""===n?e.join(""):e.join(n||this.lineSeparator())},getLine:function(e){e=this.getLineHandle(e);return e&&e.text},getLineHandle:function(e){if(bt(this,e))return F(this,e)},getLineNumber:E,getLineHandleVisualStart:function(e){return tn(e="number"==typeof e?F(this,e):e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return I(this,e)},getCursor:function(e){var t=this.sel.primary(),e=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from();return e},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:i(function(e,t,n){Ur(this,I(this,"number"==typeof e?O(e,t||0):e),null,n)}),setSelection:i(function(e,t,n){Ur(this,I(this,e),I(this,t||e),n)}),extendSelection:i(function(e,t,n){jr(this,I(this,e),t&&I(this,t),n)}),extendSelections:i(function(e,t){qr(this,Mt(this,e),t)}),extendSelectionsBy:i(function(e,t){qr(this,Mt(this,ke(this.sel.ranges,e)),t)}),setSelections:i(function(e,t,n){if(e.length){for(var i=[],r=0;r<e.length;r++)i[r]=new z(I(this,e[r].anchor),I(this,e[r].head||e[r].anchor));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),j(this,vr(this.cm,i,t),n)}}),addSelection:i(function(e,t,n){var i=this.sel.ranges.slice(0);i.push(new z(I(this,e),I(this,t||e))),j(this,vr(this.cm,i,i.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n=0;n<t.length;n++)var i=gt(this,t[n].from(),t[n].to()),r=r?r.concat(i):i;return!1===e?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,i=0;i<n.length;i++){var r=gt(this,n[i].from(),n[i].to());!1!==e&&(r=r.join(e||this.lineSeparator())),t[i]=r}return t},replaceSelection:function(e,t,n){for(var i=[],r=0;r<this.sel.ranges.length;r++)i[r]=e;this.replaceSelections(i,t,n||"+input")},replaceSelections:i(function(e,t,n){for(var i=[],r=this.sel,o=0;o<r.ranges.length;o++){var l=r.ranges[o];i[o]={from:l.from(),to:l.to(),text:this.splitLines(e[o]),origin:n}}for(var t=t&&"end"!=t&&function(e,t,n){for(var i=[],r=c=O(e.first,0),o=0;o<t.length;o++){var l=t[o],a=Cr(l.from,c,r),s=Cr(xr(l),c,r),c=l.to,r=s;"around"==n?(l=H((l=e.sel.ranges[o]).head,l.anchor)<0,i[o]=new z(l?s:a,l?a:s)):i[o]=new z(a,a)}return new B(i,e.sel.primIndex)}(this,i,t),a=i.length-1;0<=a;a--)to(this,i[a]);t?Gr(this,t):this.cm&&Ii(this.cm)}),undo:i(function(){io(this,"undo")}),redo:i(function(){io(this,"redo")}),undoSelection:i(function(){io(this,"undo",!0)}),redoSelection:i(function(){io(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var r=0;r<e.undone.length;r++)e.undone[r].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var t=this;this.history=new Ar(this.history),Mr(this,function(e){return e.history=t.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Br(this.history.done),undone:Br(this.history.undone)}},setHistory:function(e){var t=this.history=new Ar(this.history);t.done=Br(e.done.slice(0),null,!0),t.undone=Br(e.undone.slice(0),null,!0)},setGutterMarker:i(function(e,n,i){return uo(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[n]=i)&&De(t)&&(e.gutterMarkers=null),1})}),clearGutter:i(function(t){var n=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&uo(n,e,"gutter",function(){return e.gutterMarkers[t]=null,De(e.gutterMarkers)&&(e.gutterMarkers=null),1})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!bt(this,e))return null;if(!(e=F(this,t=e)))return null}else if(null==(t=E(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:i(function(e,n,i){return uo(this,e,"gutter"==n?"gutter":"class",function(e){var t="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(e[t]){if(Q(i).test(e[t]))return;e[t]+=" "+i}else e[t]=i;return 1})}),removeLineClass:i(function(e,o,l){return uo(this,e,"gutter"==o?"gutter":"class",function(e){var t="text"==o?"textClass":"background"==o?"bgClass":"gutter"==o?"gutterClass":"wrapClass",n=e[t];if(n){if(null==l)e[t]=null;else{var i=n.match(Q(l));if(!i)return;var r=i.index+i[0].length;e[t]=n.slice(0,i.index)+(i.index&&r!=n.length?" ":"")+n.slice(r)||null}return 1}})}),addLineWidget:i(function(e,t,n){return e=e,r=new po(i=this,t,n),(o=i.cm)&&r.noHScroll&&(o.display.alignWidgets=!0),uo(i,e,"widget",function(e){var t=e.widgets||(e.widgets=[]);return null==r.insertAt?t.push(r):t.splice(Math.min(t.length,Math.max(0,r.insertAt)),0,r),r.line=e,o&&!on(i,e)&&(t=ln(e)<i.scrollTop,yt(e,e.height+Dn(r)),t&&Hi(o,r.height),o.curOp.forceUpdate=!0),1}),o&&x(o,"lineWidgetAdded",o,r,"number"==typeof e?e:E(e)),r;var i,r,o}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return yo(this,I(this,e),I(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){t={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return yo(this,e=I(this,e),e,t,"bookmark")},findMarksAt:function(e){var t=[],n=F(this,(e=I(this,e)).line).markedSpans;if(n)for(var i=0;i<n.length;++i){var r=n[i];(null==r.from||r.from<=e.ch)&&(null==r.to||r.to>=e.ch)&&t.push(r.marker.parent||r.marker)}return t},findMarks:function(r,o,l){r=I(this,r),o=I(this,o);var a=[],s=r.line;return this.iter(r.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var n=0;n<t.length;n++){var i=t[n];null!=i.to&&s==r.line&&r.ch>=i.to||null==i.from&&s!=r.line||null!=i.from&&s==o.line&&i.from>=o.ch||l&&!l(i.marker)||a.push(i.marker.parent||i.marker)}++s}),a},getAllMarks:function(){var i=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var n=0;n<t.length;++n)null!=t[n].from&&i.push(t[n].marker)}),i},posFromIndex:function(t){var n,i=this.first,r=this.lineSeparator().length;return this.iter(function(e){e=e.text.length+r;if(t<e)return n=t,!0;t-=e,++i}),I(this,O(i,n))},indexFromPos:function(e){var t,n=(e=I(this,e)).ch;return e.line<this.first||e.ch<0?0:(t=this.lineSeparator().length,this.iter(this.first,e.line,function(e){n+=e.text.length+t}),n)},copy:function(e){var t=new f(vt(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){for(var t=this.first,n=this.first+this.size,n=(null!=(e=e||{}).from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to),new f(vt(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction)),i=(e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],n),r=bo(this),o=0;o<r.length;o++){var l=r[o],a=l.find(),s=i.clipPos(a.from),a=i.clipPos(a.to);H(s,a)&&(s=yo(i,s,a,l.primary,l.primary.type),l.markers.push(s),s.parent=l)}return n},unlinkDoc:function(e){if(e instanceof p&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),wo(bo(this));break}}var i;e.history==this.history&&(i=[e.id],Mr(e,function(e){return i.push(e.id)},!0),e.history=new Ar(null),e.history.done=Br(this.history.done,i),e.history.undone=Br(this.history.undone,i))},iterLinkedDocs:function(e){Mr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):it(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:i(function(e){var t;(e="rtl"!=e?"ltr":e)!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm)&&d(t=this.cm,function(){Dr(t),W(t)})})})).eachLine=f.prototype.iter,0);function So(e){var i=this;if(Lo(i),!A(i,e)&&!An(i.display,e)){T(e),b&&(ko=+new Date);var t=mi(i,e,!0),n=e.dataTransfer.files;if(t&&!i.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var r=n.length,o=Array(r),l=0,a=function(){++l==r&&P(i,function(){var e={from:t=I(i.doc,t),to:t,text:i.doc.splitLines(o.filter(function(e){return null!=e}).join(i.doc.lineSeparator())),origin:"paste"};to(i.doc,e),Gr(i.doc,yr(I(i.doc,t),I(i.doc,xr(e))))})()},s=0;s<n.length;s++)!function(e,t){var n;i.options.allowDropFileTypes&&-1==k(i.options.allowDropFileTypes,e.type)?a():((n=new FileReader).onerror=function(){return a()},n.onload=function(){var e=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[t]=e),a()},n.readAsText(e))}(n[s],s);else if(i.state.draggingText&&-1<i.doc.sel.contains(t))i.state.draggingText(e),setTimeout(function(){return i.display.input.focus()},20);else try{var c,u=e.dataTransfer.getData("Text");if(u){if(i.state.draggingText&&!i.state.draggingText.copy&&(c=i.listSelections()),Vr(i.doc,yr(t,t)),c)for(var d=0;d<c.length;++d)lo(i.doc,"",c[d].anchor,c[d].head,"drag");i.replaceSelection(u,"around","paste"),i.display.input.focus()}}catch(e){}}}function Lo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function To(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),n=[],i=0;i<e.length;i++){var r=e[i].CodeMirror;r&&n.push(r)}n.length&&n[0].operation(function(){for(var e=0;e<n.length;e++)t(n[e])})}}var Mo=!1;function No(){var e;Mo||(S(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,To(Do)},100))}),S(window,"blur",function(){return To(Di)}),Mo=!0)}function Do(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Ao={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:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Fo=0;Fo<10;Fo++)Ao[Fo+48]=Ao[Fo+96]=String(Fo);for(var Eo=65;Eo<=90;Eo++)Ao[Eo]=String.fromCharCode(Eo);for(var Oo=1;Oo<=12;Oo++)Ao[Oo+111]=Ao[Oo+63235]="F"+Oo;var Ho={};function Io(e){var t,n,i,r,o=e.split(/-(?!$)/);e=o[o.length-1];for(var l=0;l<o.length-1;l++){var a=o[l];if(/^(cmd|meta|m)$/i.test(a))r=!0;else if(/^a(lt)?$/i.test(a))t=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);i=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),r&&(e="Cmd-"+e),e=i?"Shift-"+e:e}function Wo(e){var t,n,i={};for(t in e)if(e.hasOwnProperty(t)){var r=e[t];if(!/^(name|fallthrough|(de|at)tach)$/.test(t)){if("..."!=r)for(var o=ke(t.split(" "),Io),l=0;l<o.length;l++){var a=void 0,s=void 0,a=l==o.length-1?(s=o.join(" "),r):(s=o.slice(0,l+1).join(" "),"..."),c=i[s];if(c){if(c!=a)throw new Error("Inconsistent bindings for "+s)}else i[s]=a}delete e[t]}}for(n in i)e[n]=i[n];return e}function Po(e,t,n,i){var r=(t=jo(t)).call?t.call(e,i):t[e];if(!1===r)return"nothing";if("..."===r)return"multi";if(null!=r&&n(r))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Po(e,t.fallthrough,n,i);for(var o=0;o<t.fallthrough.length;o++){var l=Po(e,t.fallthrough[o],n,i);if(l)return l}}}function Ro(e){e="string"==typeof e?e:Ao[e.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function Bo(e,t,n){var i=e;return t.altKey&&"Alt"!=i&&(e="Alt-"+e),(Y?t.metaKey:t.ctrlKey)&&"Ctrl"!=i&&(e="Ctrl-"+e),(Y?t.ctrlKey:t.metaKey)&&"Mod"!=i&&(e="Cmd-"+e),e=!n&&t.shiftKey&&"Shift"!=i?"Shift-"+e:e}function zo(e,t){var n;return!(U&&34==e.keyCode&&e.char||null==(n=Ao[e.keyCode])||e.altGraphKey)&&Bo(n=3==e.keyCode&&e.code?e.code:n,e,t)}function jo(e){return"string"==typeof e?Ho[e]:e}function qo(t,e){for(var n=t.doc.sel.ranges,i=[],r=0;r<n.length;r++){for(var o=e(n[r]);i.length&&H(o.from,R(i).to)<=0;){var l=i.pop();if(H(l.from,o.from)<0){o.from=l.from;break}}i.push(o)}d(t,function(){for(var e=i.length-1;0<=e;e--)lo(t.doc,"",i[e].from,i[e].to,"+delete");Ii(t)})}function _o(e,t,n){t=Ee(e.text,t+n,n);return t<0||t>e.text.length?null:t}function Uo(e,t,n){e=_o(e,t.ch,n);return null==e?null:new O(t.line,e,n<0?"after":"before")}function Go(e,t,n,i,r){if(e){"rtl"==t.doc.direction&&(r=-r);var o,l,a,s,e=_e(n,t.doc.direction);if(e)return o=r<0==(1==(e=r<0?R(e):e[0]).level)?"after":"before",0<e.level||"rtl"==t.doc.direction?(l=zn(t,n),a=r<0?n.text.length-1:0,s=jn(t,l,a).top,a=Oe(function(e){return jn(t,l,e).top==s},r<0==(1==e.level)?e.from:e.to-1,a),"before"==o&&(a=_o(n,a,1))):a=r<0?e.to:e.from,new O(i,a,o)}return new O(i,r<0?n.text.length:0,r<0?"before":"after")}function Vo(t,n,a,e){var s=_e(n,t.doc.direction);if(!s)return Uo(n,a,e);a.ch>=n.text.length?(a.ch=n.text.length,a.sticky="before"):a.ch<=0&&(a.ch=0,a.sticky="after");var i=Ie(s,a.ch,a.sticky),r=s[i];if("ltr"==t.doc.direction&&r.level%2==0&&(0<e?r.to>a.ch:r.from<a.ch))return Uo(n,a,e);function c(e,t){return _o(n,e instanceof O?e.ch:e,t)}function o(e){return t.options.lineWrapping?(l=l||zn(t,n),oi(t,n,l,e)):{begin:0,end:n.text.length}}var l,u=o("before"==a.sticky?c(a,-1):a.ch);if("rtl"==t.doc.direction||1==r.level){var d=1==r.level==e<0,h=c(a,d?1:-1);if(null!=h&&(d?h<=r.to&&h<=u.end:h>=r.from&&h>=u.begin))return new O(a.line,h,d?"before":"after")}function f(e,t,n){for(var i=function(e,t){return t?new O(a.line,c(e,1),"before"):new O(a.line,e,"after")};0<=e&&e<s.length;e+=t){var r=s[e],o=0<t==(1!=r.level),l=o?n.begin:c(n.end,-1);if(r.from<=l&&l<r.to)return i(l,o);if(l=o?r.from:c(r.to,-1),n.begin<=l&&l<n.end)return i(l,o)}}r=f(i+e,e,u);return r||(null==(h=0<e?u.end:c(u.begin,-1))||0<e&&h==n.text.length||!(r=f(0<e?0:s.length-1,e,o(h)))?null:r)}Ho.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"},Ho.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"},Ho.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ho.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"]},Ho.default=C?Ho.macDefault:Ho.pcDefault;var $o={selectAll:Jr,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ve)},killLine:function(n){return qo(n,function(e){var t;return e.empty()?(t=F(n.doc,e.head.line).text.length,e.head.ch==t&&e.head.line<n.lastLine()?{from:e.head,to:O(e.head.line+1,0)}:{from:e.head,to:O(e.head.line,t)}):{from:e.from(),to:e.to()}})},deleteLine:function(t){return qo(t,function(e){return{from:O(e.from().line,0),to:I(t.doc,O(e.to().line+1,0))}})},delLineLeft:function(e){return qo(e,function(e){return{from:O(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(n){return qo(n,function(e){var t=n.charCoords(e.head,"div").top+5;return{from:n.coordsChar({left:0,top:t},"div"),to:e.from()}})},delWrappedLineRight:function(n){return qo(n,function(e){var t=n.charCoords(e.head,"div").top+5,t=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:t}})},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(O(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(O(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return Xo(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return Ko(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(r){return r.extendSelectionsBy(function(e){var t=r,e=e.head.line,n=F(t.doc,e),i=function(e){for(var t;t=Jt(e);)e=t.find(1,!0).line;return e}(n);return i!=n&&(e=E(i)),Go(!0,t,n,e,-1)},{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy(function(e){e=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:e},"div")},xe)},goLineLeft:function(t){return t.extendSelectionsBy(function(e){e=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:e},"div")},xe)},goLineLeftSmart:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5,t=n.coordsChar({left:0,top:t},"div");return t.ch<n.getLine(t.line).search(/\S/)?Ko(n,e.head):t},xe)},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,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),i=e.options.tabSize,r=0;r<n.length;r++){var o=n[r].from(),o=fe(e.getLine(o.line),o.ch,i);t.push(Ce(i-o%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(l){return d(l,function(){for(var e,t,n,i=l.listSelections(),r=[],o=0;o<i.length;o++)i[o].empty()&&(e=i[o].head,(t=F(l.doc,e.line).text)&&(0<(e=e.ch==t.length?new O(e.line,e.ch-1):e).ch?(e=new O(e.line,e.ch+1),l.replaceRange(t.charAt(e.ch-1)+t.charAt(e.ch-2),O(e.line,e.ch-2),e,"+transpose")):e.line>l.doc.first&&(n=F(l.doc,e.line-1).text)&&(e=new O(e.line,1),l.replaceRange(t.charAt(0)+l.doc.lineSeparator()+n.charAt(n.length-1),O(e.line-1,n.length-1),e,"+transpose"))),r.push(new z(e,e)));l.setSelections(r)})},newlineAndIndent:function(i){return d(i,function(){for(var e=(t=i.listSelections()).length-1;0<=e;e--)i.replaceRange(i.doc.lineSeparator(),t[e].anchor,t[e].head,"+input");for(var t=i.listSelections(),n=0;n<t.length;n++)i.indentLine(t[n].from().line,null,!0);Ii(i)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Xo(e,t){var n=F(e.doc,t),i=tn(n);return Go(!0,e,i,t=i!=n?E(i):t,1)}function Ko(e,t){var n=Xo(e,t.line),i=F(e.doc,n.line),e=_e(i,e.doc.direction);return e&&0!=e[0].level?n:(e=Math.max(n.ch,i.text.search(/\S/)),i=t.line==n.line&&t.ch<=e&&t.ch,O(n.line,i?0:e,n.sticky))}function Yo(e,t,n){if("string"==typeof t&&!(t=$o[t]))return!1;e.display.input.ensurePolled();var i=e.display.shift,r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),r=t(e)!=ge}finally{e.display.shift=i,e.state.suppressEdits=!1}return r}var Zo=new pe;function Qo(e,t,n,i){var r=e.state.keySeq;if(r){if(Ro(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Zo.set(50,function(){e.state.keySeq==r&&(e.state.keySeq=null,e.display.input.reset())}),Jo(e,r+" "+t,n,i))return!0}return Jo(e,t,n,i)}function Jo(e,t,n,i){i=function(e,t,n){for(var i=0;i<e.state.keyMaps.length;i++){var r=Po(t,e.state.keyMaps[i],n,e);if(r)return r}return e.options.extraKeys&&Po(t,e.options.extraKeys,n,e)||Po(t,e.options.keyMap,n,e)}(e,t,i);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&x(e,"keyHandled",e,t,n),"handled"!=i&&"multi"!=i||(T(n),Li(e)),!!i}function el(t,e){var n=zo(e,!0);return!!n&&(e.shiftKey&&!t.state.keySeq?Qo(t,"Shift-"+n,e,function(e){return Yo(t,e,!0)})||Qo(t,n,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return Yo(t,e)}):Qo(t,n,e,function(e){return Yo(t,e)}))}var tl=null;function nl(e){var t,n,i,r=this;function o(e){18!=e.keyCode&&e.altKey||(J(i,"CodeMirror-crosshair"),L(document,"keyup",o),L(document,"mouseover",o))}e.target&&e.target!=r.display.input.getField()||(r.curOp.focus=N(se(r)),A(r,e))||(b&&v<11&&27==e.keyCode&&(e.returnValue=!1),t=e.keyCode,r.display.shift=16==t||e.shiftKey,n=el(r,e),U&&(tl=n?t:null,!n)&&88==t&&!ot&&(C?e.metaKey:e.ctrlKey)&&r.replaceSelection("",null,"cut"),g&&!C&&!n&&46==t&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=t)||/\bCodeMirror-crosshair\b/.test(r.display.lineDiv.className)||(ie(i=r.display.lineDiv,"CodeMirror-crosshair"),S(document,"keyup",o),S(document,"mouseover",o))}function il(e){16==e.keyCode&&(this.doc.sel.shift=!1),A(this,e)}function rl(e){var t,n,i,r=this;e.target&&e.target!=r.display.input.getField()||An(r.display,e)||A(r,e)||e.ctrlKey&&!e.altKey||C&&e.metaKey||(n=e.keyCode,t=e.charCode,U&&n==tl?(tl=null,T(e)):U&&(!e.which||e.which<10)&&el(r,e)||"\b"==(n=String.fromCharCode(null==t?n:t))||Qo(i=r,"'"+n+"'",e,function(e){return Yo(i,e,!0)})||r.display.input.onKeyPress(e))}function ol(e,t,n){this.time=e,this.pos=t,this.button=n}var ll,al;function sl(e){var t,n,i,r,o,l,a,s,c,u=this,d=u.display;A(u,e)||d.activeTouch&&d.input.supportsTouch()||(d.input.ensurePolled(),d.shift=e.shiftKey,An(d,e)?w||(d.scroller.draggable=!1,setTimeout(function(){return d.scroller.draggable=!0},100)):dl(u,e)||(t=mi(u,e),n=Je(e),i=t?(r=t,o=n,i=+new Date,al&&al.compare(i,r,o)?(ll=al=null,"triple"):ll&&ll.compare(i,r,o)?(al=new ol(i,r,o),ll=null,"double"):(ll=new ol(i,r,o),al=null,"single")):"single",ue(u).focus(),1==n&&u.state.selectingText&&u.state.selectingText(e),t&&function(n,e,i,t,r){var o="Click";"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o);return Qo(n,Bo(o=(1==e?"Left":2==e?"Middle":"Right")+o,r),r,function(e){if(!(e="string"==typeof e?$o[e]:e))return!1;var t=!1;try{n.isReadOnly()&&(n.state.suppressEdits=!0),t=e(n,i)!=ge}finally{n.state.suppressEdits=!1}return t})}(u,n,t,i,e))||(1==n?t?(r=u,o=t,l=i,a=e,b?setTimeout(de(Ti,r),0):r.curOp.focus=N(se(r)),s=function(e,t,n){var i=e.getOption("configureMouse"),i=i?i(e,t,n):{};{var r;null==i.unit&&(r=K?n.shiftKey&&n.metaKey:n.altKey,i.unit=r?"rectangle":"single"==t?"char":"double"==t?"word":"line")}null!=i.extend&&!e.doc.extend||(i.extend=e.doc.extend||n.shiftKey);null==i.addNew&&(i.addNew=C?n.metaKey:n.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(C?n.altKey:n.ctrlKey));return i}(r,l,a),c=r.doc.sel,(r.options.dragDrop&&nt&&!r.isReadOnly()&&"single"==l&&-1<(l=c.contains(o))&&(H((l=c.ranges[l]).from(),o)<0||0<o.xRel)&&(0<H(l.to(),o)||o.xRel<0)?function(t,n,i,r){var o=t.display,l=!1,a=P(t,function(e){w&&(o.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:Mi(t)),L(o.wrapper.ownerDocument,"mouseup",a),L(o.wrapper.ownerDocument,"mousemove",s),L(o.scroller,"dragstart",c),L(o.scroller,"drop",a),l||(T(e),r.addNew||jr(t.doc,i,null,null,r.extend),w&&!G||b&&9==v?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),s=function(e){l=l||10<=Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY)},c=function(){return l=!0};w&&(o.scroller.draggable=!0);(t.state.draggingText=a).copy=!r.moveOnDrag,S(o.wrapper.ownerDocument,"mouseup",a),S(o.wrapper.ownerDocument,"mousemove",s),S(o.scroller,"dragstart",c),S(o.scroller,"drop",a),t.state.delayingBlurEvent=!0,setTimeout(function(){return o.input.focus()},20),o.scroller.dragDrop&&o.scroller.dragDrop()}:function(h,e,f,p){b&&Mi(h);var l=h.display,m=h.doc;T(e);var g,v,y=m.sel,t=y.ranges;p.addNew&&!p.extend?(v=m.sel.contains(f),g=-1<v?t[v]:new z(f,f)):(g=m.sel.primary(),v=m.sel.primIndex);"rectangle"==p.unit?(p.addNew||(g=new z(f,f)),f=mi(h,e,!0,!0),v=-1):(e=cl(h,f,p.unit),g=p.extend?zr(g,e.anchor,e.head,p.extend):e);p.addNew?-1==v?(v=t.length,j(m,vr(h,t.concat([g]),v),{scroll:!1,origin:"*mouse"})):1<t.length&&t[v].empty()&&"char"==p.unit&&!p.extend?(j(m,vr(h,t.slice(0,v).concat(t.slice(v+1)),0),{scroll:!1,origin:"*mouse"}),y=m.sel):_r(m,v,g,ye):(j(m,new B([g],v=0),ye),y=m.sel);var x=f;function a(e){if(0!=H(x,e))if(x=e,"rectangle"==p.unit){for(var t=[],n=h.options.tabSize,i=fe(F(m,f.line).text,f.ch,n),r=fe(F(m,e.line).text,e.ch,n),o=Math.min(i,r),l=Math.max(i,r),a=Math.min(f.line,e.line),s=Math.min(h.lastLine(),Math.max(f.line,e.line));a<=s;a++){var c=F(m,a).text,u=be(c,o,n);o==l?t.push(new z(O(a,u),O(a,u))):c.length>u&&t.push(new z(O(a,u),O(a,be(c,l,n))))}t.length||t.push(new z(f,f)),j(m,vr(h,y.ranges.slice(0,v).concat(t),v),{origin:"*mouse",scroll:!1}),h.scrollIntoView(e)}else{var d,i=g,r=cl(h,e,p.unit),e=i.anchor,e=0<H(r.anchor,e)?(d=r.head,Lt(i.from(),r.anchor)):(d=r.anchor,St(i.to(),r.head)),i=y.ranges.slice(0);i[v]=function(e,t){var n=t.anchor,i=t.head,r=F(e.doc,n.line);if(0==H(n,i)&&n.sticky==i.sticky)return t;r=_e(r);if(!r)return t;var o=Ie(r,n.ch,n.sticky),l=r[o];if(l.from!=n.ch&&l.to!=n.ch)return t;var a=o+(l.from==n.ch==(1!=l.level)?0:1);if(0==a||a==r.length)return t;l=i.line!=n.line?0<(i.line-n.line)*("ltr"==e.doc.direction?1:-1):(e=Ie(r,i.ch,i.sticky),o=e-o||(i.ch-n.ch)*(1==l.level?-1:1),e==a-1||e==a?o<0:0<o);e=r[a+(l?-1:0)],o=l==(1==e.level),r=o?e.from:e.to,a=o?"after":"before";return n.ch==r&&n.sticky==a?t:new z(new O(n.line,r,a),i)}(h,new z(I(m,e),d)),j(m,vr(h,i,v),ye)}}var s=l.wrapper.getBoundingClientRect(),c=0;function n(e){h.state.selectingText=!1,c=1/0,e&&(T(e),l.input.focus()),L(l.wrapper.ownerDocument,"mousemove",i),L(l.wrapper.ownerDocument,"mouseup",r),m.history.lastSelOrigin=null}var i=P(h,function(e){(0!==e.buttons&&Je(e)?function e(t){var n,i,r=++c,o=mi(h,t,!0,"rectangle"==p.unit);o&&(0!=H(o,x)?(h.curOp.focus=N(se(h)),a(o),n=Ei(l,m),(o.line>=n.to||o.line<n.from)&&setTimeout(P(h,function(){c==r&&e(t)}),150)):(i=t.clientY<s.top?-20:t.clientY>s.bottom?20:0)&&setTimeout(P(h,function(){c==r&&(l.scroller.scrollTop+=i,e(t))}),50))}:n)(e)}),r=P(h,n);h.state.selectingText=r,S(l.wrapper.ownerDocument,"mousemove",i),S(l.wrapper.ownerDocument,"mouseup",r)})(r,a,o,s)):Qe(e)==d.scroller&&T(e):2==n?(t&&jr(u.doc,t),setTimeout(function(){return d.input.focus()},20)):3==n&&(Z?u.display.input.onContextMenu(e):Mi(u))))}function cl(e,t,n){return"char"==n?new z(t,t):"word"==n?e.findWordAt(t):"line"==n?new z(O(t.line,0),I(e.doc,O(t.line+1,0))):(n=n(e,t),new z(n.from,n.to))}function ul(e,t,n,i){var r,o;if(t.touches)r=t.touches[0].clientX,o=t.touches[0].clientY;else try{r=t.clientX,o=t.clientY}catch(e){return!1}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&T(t);var l=e.display,i=l.lineDiv.getBoundingClientRect();if(o>i.bottom||!$e(e,n))return Ye(t);o-=i.top-l.viewOffset;for(var a=0;a<e.display.gutterSpecs.length;++a){var s=l.gutters.childNodes[a];if(s&&s.getBoundingClientRect().right>=r)return D(e,n,e,xt(e.doc,o),e.display.gutterSpecs[a].className,t),Ye(t)}}function dl(e,t){return ul(e,t,"gutterClick",!0)}function hl(e,t){var n,i;An(e.display,t)||(i=t,$e(n=e,"gutterContextMenu")&&ul(n,i,"gutterContextMenu",!1))||(A(e,t,"contextmenu")||Z||e.display.input.onContextMenu(t))}function fl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),$n(e)}ol.prototype.compare=function(e,t,n){return this.time+400>e&&0==H(t,this.pos)&&n==this.button};var pl={toString:function(){return"CodeMirror.Init"}},ml={},gl={};function vl(e,t,n){!t!=!(n&&n!=pl)&&(n=e.display.dragFunctions,(t=t?S:L)(e.display.scroller,"dragstart",n.start),t(e.display.scroller,"dragenter",n.enter),t(e.display.scroller,"dragover",n.over),t(e.display.scroller,"dragleave",n.leave),t(e.display.scroller,"drop",n.drop))}function yl(e){e.options.lineWrapping?(ie(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(J(e.display.wrapper,"CodeMirror-wrap"),sn(e)),pi(e),W(e),$n(e),setTimeout(function(){return Gi(e)},100)}function p(e,t){var n=this;if(!(this instanceof p))return new p(e,t);this.options=t=t?he(t):{},he(ml,t,!1);var i,r=t.value,o=("string"==typeof r?r=new f(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r,new p.inputStyles[t.inputStyle](this)),e=this.display=new dr(e,r,o,t),l=(fl(e.wrapper.CodeMirror=this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Xi(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new pe,keySeq:null,specialChars:null},t.autofocus&&!X&&e.input.focus(),b&&v<11&&setTimeout(function(){return n.display.input.reset(!0)},20),this),a=l.display;S(a.scroller,"mousedown",P(l,sl)),S(a.scroller,"dblclick",b&&v<11?P(l,function(e){var t;A(l,e)||!(t=mi(l,e))||dl(l,e)||An(l.display,e)||(T(e),e=l.findWordAt(t),jr(l.doc,e.anchor,e.head))}):function(e){return A(l,e)||T(e)}),S(a.scroller,"contextmenu",function(e){return hl(l,e)}),S(a.input.getField(),"contextmenu",function(e){a.scroller.contains(e.target)||hl(l,e)});var s,c={end:0};function u(){a.activeTouch&&(s=setTimeout(function(){return a.activeTouch=null},1e3),(c=a.activeTouch).end=+new Date)}function d(e,t){var n;return null==t.left||400<(n=t.left-e.left)*n+(n=t.top-e.top)*n}S(a.scroller,"touchstart",function(e){var t;A(l,e)||function(e){if(1==e.touches.length)return(e=e.touches[0]).radiusX<=1&&e.radiusY<=1}(e)||dl(l,e)||(a.input.ensurePolled(),clearTimeout(s),t=+new Date,a.activeTouch={start:t,moved:!1,prev:t-c.end<=300?c:null},1==e.touches.length&&(a.activeTouch.left=e.touches[0].pageX,a.activeTouch.top=e.touches[0].pageY))}),S(a.scroller,"touchmove",function(){a.activeTouch&&(a.activeTouch.moved=!0)}),S(a.scroller,"touchend",function(e){var t,n=a.activeTouch;n&&!An(a,e)&&null!=n.left&&!n.moved&&new Date-n.start<300&&(t=l.coordsChar(a.activeTouch,"page"),n=!n.prev||d(n,n.prev)?new z(t,t):!n.prev.prev||d(n,n.prev.prev)?l.findWordAt(t):new z(O(t.line,0),I(l.doc,O(t.line+1,0))),l.setSelection(n.anchor,n.head),l.focus(),T(e)),u()}),S(a.scroller,"touchcancel",u),S(a.scroller,"scroll",function(){a.scroller.clientHeight&&(Bi(l,a.scroller.scrollTop),ji(l,a.scroller.scrollLeft,!0),D(l,"scroll",l))}),S(a.scroller,"mousewheel",function(e){return gr(l,e)}),S(a.scroller,"DOMMouseScroll",function(e){return gr(l,e)}),S(a.wrapper,"scroll",function(){return a.wrapper.scrollTop=a.wrapper.scrollLeft=0}),a.dragFunctions={enter:function(e){A(l,e)||Ze(e)},over:function(e){var t,n;A(l,e)||((n=mi(t=l,n=e))&&(ki(t,n,n=document.createDocumentFragment()),t.display.dragCursor||(t.display.dragCursor=M("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),y(t.display.dragCursor,n)),Ze(e))},start:function(e){var t,n;t=l,e=e,b&&(!t.state.draggingText||+new Date-ko<100)?Ze(e):A(t,e)||An(t.display,e)||(e.dataTransfer.setData("Text",t.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!G&&((n=M("img",null,null,"position: fixed; left: 0; top: 0;")).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",U&&(n.width=n.height=1,t.display.wrapper.appendChild(n),n._top=n.offsetTop),e.dataTransfer.setDragImage(n,0,0),U)&&n.parentNode.removeChild(n))},drop:P(l,So),leave:function(e){A(l,e)||Lo(l)}};o=a.input.getField();for(i in S(o,"keyup",function(e){return il.call(l,e)}),S(o,"keydown",P(l,nl)),S(o,"keypress",P(l,rl)),S(o,"focus",function(e){return Ni(l,e)}),S(o,"blur",function(e){return Di(l,e)}),No(),Yi(this),this.curOp.forceUpdate=!0,Nr(this,r),t.autofocus&&!X||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ni(n)},20):Di(this),gl)gl.hasOwnProperty(i)&&gl[i](this,t[i],pl);ar(this),t.finishInit&&t.finishInit(this);for(var h=0;h<xl.length;++h)xl[h](this);Zi(this),w&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(e.lineDiv).textRendering&&(e.lineDiv.style.textRendering="auto")}p.defaults=ml,p.optionHandlers=gl;var xl=[];function bl(e,t,n,i){var r,o=e.doc,l=("smart"==(n=null==n?"add":n)&&(o.mode.indent?r=Et(e,t).state:n="prev"),e.options.tabSize),a=F(o,t),s=fe(a.text,null,l),c=(a.stateAfter&&(a.stateAfter=null),a.text.match(/^\s*/)[0]);if(i||/\S/.test(a.text)){if("smart"==n&&((u=o.mode.indent(r,a.text.slice(c.length),a.text))==ge||150<u)){if(!i)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?fe(F(o,t-1).text,null,l):0:"add"==n?u=s+e.options.indentUnit:"subtract"==n?u=s-e.options.indentUnit:"number"==typeof n&&(u=s+n);var u=Math.max(0,u),d="",h=0;if(e.options.indentWithTabs)for(var f=Math.floor(u/l);f;--f)h+=l,d+="\t";if(h<u&&(d+=Ce(u-h)),d!=c)return lo(o,d,O(t,0),O(t,c.length),"+input"),!(a.stateAfter=null);for(var p=0;p<o.sel.ranges.length;p++){var m=o.sel.ranges[p];if(m.head.line==t&&m.head.ch<c.length){m=O(t,c.length);_r(o,p,new z(m,m));break}}}p.defineInitHook=function(e){return xl.push(e)};var wl=null;function Cl(e){wl=e}function kl(e,t,n,i,r){var o=e.doc,l=(e.display.shift=!1,i=i||o.sel,+new Date-200),a="paste"==r||e.state.pasteIncoming>l,s=it(t),c=null;if(a&&1<i.ranges.length)if(wl&&wl.text.join("\n")==t){if(i.ranges.length%wl.text.length==0)for(var c=[],u=0;u<wl.text.length;u++)c.push(o.splitLines(wl.text[u]))}else s.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(c=ke(s,function(e){return[e]}));for(var d=e.curOp.updateInput,h=i.ranges.length-1;0<=h;h--){var f=i.ranges[h],p=f.from(),m=f.to(),f=(f.empty()&&(n&&0<n?p=O(p.line,p.ch-n):e.state.overwrite&&!a?m=O(m.line,Math.min(F(o,m.line).text.length,m.ch+R(s).length)):a&&wl&&wl.lineWise&&wl.text.join("\n")==s.join("\n")&&(p=m=O(p.line,0))),{from:p,to:m,text:c?c[h%c.length]:s,origin:r||(a?"paste":e.state.cutIncoming>l?"cut":"+input")});to(e.doc,f),x(e,"inputRead",e,f)}t&&!a&&Ll(e,t),Ii(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Sl(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");return n&&(e.preventDefault(),t.isReadOnly()||t.options.disableInput||!t.hasFocus()||d(t,function(){return kl(t,n,0,null,"paste")}),1)}function Ll(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,i=n.ranges.length-1;0<=i;i--){var r=n.ranges[i];if(!(100<r.head.ch||i&&n.ranges[i-1].head.line==r.head.line)){var o=e.getModeAt(r.head),l=!1;if(o.electricChars){for(var a=0;a<o.electricChars.length;a++)if(-1<t.indexOf(o.electricChars.charAt(a))){l=bl(e,r.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(F(e.doc,r.head.line).text.slice(0,r.head.ch))&&(l=bl(e,r.head.line,"smart"));l&&x(e,"electricInput",e,r.head.line)}}}function Tl(e){for(var t=[],n=[],i=0;i<e.doc.sel.ranges.length;i++){var r=e.doc.sel.ranges[i].head.line,r={anchor:O(r,0),head:O(r+1,0)};n.push(r),t.push(e.getRange(r.anchor,r.head))}return{text:t,ranges:n}}function Ml(e,t,n,i){e.setAttribute("autocorrect",n?"on":"off"),e.setAttribute("autocapitalize",i?"on":"off"),e.setAttribute("spellcheck",!!t)}function Nl(){var e=M("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=M("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return w?e.style.width="1000px":e.setAttribute("wrap","off"),h&&(e.style.border="1px solid black"),t}function Dl(n,i,r,o,l){var e=i,t=r,a=F(n,i.line),s=l&&"rtl"==n.direction?-r:r;function c(e){var t;if(null==(t="codepoint"==o?(t=a.text.charCodeAt(i.ch+(0<r?0:-1)),isNaN(t)?null:(t=0<r?55296<=t&&t<56320:56320<=t&&t<57343,new O(i.line,Math.max(0,Math.min(a.text.length,i.ch+r*(t?2:1))),-r))):l?Vo(n.cm,a,i,r):Uo(a,i,r))){if(e||(e=i.line+s)<n.first||e>=n.first+n.size||(i=new O(e,i.ch,i.sticky),!(a=F(n,e))))return;i=Go(l,n.cm,a,i.line,s)}else i=t;return 1}if("char"==o||"codepoint"==o)c();else if("column"==o)c(!0);else if("word"==o||"group"==o)for(var u=null,d="group"==o,h=n.cm&&n.cm.getHelper(i,"wordChars"),f=!0;!(r<0)||c(!f);f=!1){var p=a.text.charAt(i.ch)||"\n",p=Ne(p,h)?"w":d&&"\n"==p?"n":!d||/\s/.test(p)?null:"p";if(d&&!f&&(p=p||"s"),u&&u!=p){r<0&&(r=1,c(),i.sticky="after");break}if(p&&(u=p),0<r&&!c(!f))break}t=Zr(n,i,e,t,!0);return Ct(e,t)&&(t.hitSide=!0),t}function Al(e,t,n,i){var r,o,l,a=e.doc,s=t.left;for("page"==i?(r=Math.min(e.display.wrapper.clientHeight,ue(e).innerHeight||a(e).documentElement.clientHeight),r=Math.max(r-.5*ci(e.display),3),o=(0<n?t.bottom:t.top)+n*r):"line"==i&&(o=0<n?t.bottom+3:t.top-3);(l=ii(e,s,o)).outside;){if(n<0?o<=0:o>=a.height){l.hitSide=!0;break}o+=5*n}return l}function r(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new pe,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}function Fl(e,t){var n,i,r=Bn(e,t.line);return!r||r.hidden?null:(n=Pn(r,r=F(e.doc,t.line),t.line),i="left",(r=_e(r,e.doc.direction))&&(i=Ie(r,t.ch)%2?"right":"left"),(e=Un(n.map,t.ch,i)).offset="right"==e.collapse?e.end:e.start,e)}function El(e,t){return t&&(e.bad=!0),e}function Ol(e,t,n){var i;if(t==e.display.lineDiv){if(!(i=e.display.lineDiv.childNodes[n]))return El(e.clipPos(O(e.display.viewTo-1)),!0);t=null,n=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var r=0;r<e.display.view.length;r++){var o=e.display.view[r];if(o.node==i){var c=o,o=t,l=n,a=c.text.firstChild,s=!1;if(!o||!ne(a,o))return El(O(E(c.line),0),!0);if(o==a)if(s=!0,o=a.childNodes[l],l=0,!o)return El(O(E(u=c.rest?R(c.rest):c.line),u.text.length),s);var u=3==o.nodeType?o:null,d=o;for(u||1!=o.childNodes.length||3!=o.firstChild.nodeType||(u=o.firstChild,l=l&&u.nodeValue.length);d.parentNode!=a;)d=d.parentNode;var h=c.measure,f=h.maps;function p(e,t,n){for(var i=-1;i<(f?f.length:0);i++)for(var r=i<0?h.map:f[i],o=0;o<r.length;o+=3){var l,a,s=r[o+2];if(s==e||s==t)return l=E(i<0?c.line:c.rest[i]),a=r[o]+n,O(l,a=n<0||s!=e?r[o+(n?1:0)]:a)}}var m=p(u,d,l);if(m)return El(m,s);for(var g=d.nextSibling,v=u?u.nodeValue.length-l:0;g;g=g.nextSibling){if(m=p(g,g.firstChild,0))return El(O(m.line,m.ch-v),s);v+=g.textContent.length}for(var y=d.previousSibling,x=l;y;y=y.previousSibling){if(m=p(y,y.firstChild,-1))return El(O(m.line,m.ch+x),s);x+=y.textContent.length}return}}}r.prototype.init=function(e){var t=this,o=this,l=o.cm,a=o.div=e.lineDiv;function s(e){for(var t=e.target;t;t=t.parentNode){if(t==a)return 1;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}}function n(e){if(s(e)&&!A(l,e)){if(l.somethingSelected())Cl({lineWise:!1,text:l.getSelections()}),"cut"==e.type&&l.replaceSelection("",null,"cut");else{if(!l.options.lineWiseCopyCut)return;var t=Tl(l);Cl({lineWise:!0,text:t.text}),"cut"==e.type&&l.operation(function(){l.setSelections(t.ranges,0,ve),l.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=wl.text.join("\n");if(e.clipboardData.setData("Text",n),e.clipboardData.getData("Text")==n)return void e.preventDefault()}var i=Nl(),n=i.firstChild,r=(Ml(n),l.display.lineSpace.insertBefore(i,l.display.lineSpace.firstChild),n.value=wl.text.join("\n"),N(ce(a)));le(n),setTimeout(function(){l.display.lineSpace.removeChild(i),r.focus(),r==a&&o.showPrimarySelection()},50)}}a.contentEditable=!0,Ml(a,l.options.spellcheck,l.options.autocorrect,l.options.autocapitalize),S(a,"paste",function(e){!s(e)||A(l,e)||Sl(e,l)||v<=11&&setTimeout(P(l,function(){return t.updateFromDOM()}),20)}),S(a,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),S(a,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),S(a,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),S(a,"touchstart",function(){return o.forceCompositionEnd()}),S(a,"input",function(){t.composing||t.readFromDOMSoon()}),S(a,"copy",n),S(a,"cut",n)},r.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},r.prototype.prepareSelection=function(){var e=Ci(this.cm,!1);return e.focus=N(ce(this.div))==this.div,e},r.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},r.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},r.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),n=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||n.line<t.display.viewFrom)e.removeAllRanges();else{var r=Ol(t,e.anchorNode,e.anchorOffset),o=Ol(t,e.focusNode,e.focusOffset);if(!r||r.bad||!o||o.bad||0!=H(Lt(r,o),i)||0!=H(St(r,o),n)){var r=t.display.view,o=i.line>=t.display.viewFrom&&Fl(t,i)||{node:r[0].measure.map[2],offset:0},i=n.line<t.display.viewTo&&Fl(t,n);if(i||(i={node:(r=(n=r[r.length-1].measure).maps?n.maps[n.maps.length-1]:n.map)[r.length-1],offset:r[r.length-2]-r[r.length-3]}),o&&i){var l,n=e.rangeCount&&e.getRangeAt(0);try{l=oe(o.node,o.offset,i.offset,i.node)}catch(e){}l&&(!g&&t.state.focused&&(e.collapse(o.node,o.offset),l.collapsed)||(e.removeAllRanges(),e.addRange(l)),n&&null==e.anchorNode?e.addRange(n):g&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},r.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},r.prototype.showMultipleSelections=function(e){y(this.cm.display.cursorDiv,e.cursors),y(this.cm.display.selectionDiv,e.selection)},r.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},r.prototype.selectionInEditor=function(){var e=this.getSelection();return!!e.rangeCount&&(e=e.getRangeAt(0).commonAncestorContainer,ne(this.div,e))},r.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&N(ce(this.div))==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},r.prototype.blur=function(){this.div.blur()},r.prototype.getField=function(){return this.div},r.prototype.supportsTouch=function(){return!0},r.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):d(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))})},r.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},r.prototype.pollSelection=function(){var e,t,n,i;null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()&&(e=this.getSelection(),t=this.cm,$&&q&&this.cm.display.gutterSpecs.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return 1;return}(e.anchorNode)?(this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus()):this.composing||(this.rememberSelection(),n=Ol(t,e.anchorNode,e.anchorOffset),i=Ol(t,e.focusNode,e.focusOffset),n&&i&&d(t,function(){j(t.doc,yr(n,i),ve),(n.bad||i.bad)&&(t.curOp.selectionChanged=!0)})))},r.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t=this.cm,n=t.display,i=t.doc.sel.primary(),r=i.from(),i=i.to();if(0==r.ch&&r.line>t.firstLine()&&(r=O(r.line-1,F(t.doc,r.line-1).length)),i.ch==F(t.doc,i.line).text.length&&i.line<t.lastLine()&&(i=O(i.line+1,0)),r.line<n.viewFrom||i.line>n.viewTo-1)return!1;var o,l=r.line==n.viewFrom||0==(l=gi(t,r.line))?(e=E(n.view[0].line),n.view[0].node):(e=E(n.view[l].line),n.view[l-1].node.nextSibling),i=gi(t,i.line),n=i==n.view.length-1?(o=n.viewTo-1,n.lineDiv.lastChild):(o=E(n.view[i+1].line)-1,n.view[i+1].node.previousSibling);if(!l)return!1;for(var a=t.doc.splitLines(function(o,e,t,l,a){var n="",s=!1,c=o.doc.lineSeparator(),u=!1;function d(){s&&(n+=c,u&&(n+=c),s=u=!1)}function h(e){e&&(d(),n+=e)}for(;!function e(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)h(n);else if(n=t.getAttribute("cm-marker"))(n=o.findMarks(O(l,0),O(a+1,0),(r=+n,function(e){return e.id==r}))).length&&(n=n[0].find(0))&&h(gt(o.doc,n.from,n.to).join(c));else if("false"!=t.getAttribute("contenteditable")&&(n=/^(pre|div|p|li|table|br)$/i.test(t.nodeName),/^br$/i.test(t.nodeName)||0!=t.textContent.length)){n&&d();for(var i=0;i<t.childNodes.length;i++)e(t.childNodes[i]);/^(pre|p)$/i.test(t.nodeName)&&(u=!0),n&&(s=!0)}}else 3==t.nodeType&&h(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var r}(e),e!=t;)e=e.nextSibling,u=!1;return n}(t,l,n,e,o)),s=gt(t.doc,O(e,0),O(o,F(t.doc,o).text.length));1<a.length&&1<s.length;)if(R(a)==R(s))a.pop(),s.pop(),o--;else{if(a[0]!=s[0])break;a.shift(),s.shift(),e++}for(var c=0,u=0,d=a[0],h=s[0],f=Math.min(d.length,h.length);c<f&&d.charCodeAt(c)==h.charCodeAt(c);)++c;for(var p=R(a),m=R(s),g=Math.min(p.length-(1==a.length?c:0),m.length-(1==s.length?c:0));u<g&&p.charCodeAt(p.length-u-1)==m.charCodeAt(m.length-u-1);)++u;if(1==a.length&&1==s.length&&e==r.line)for(;c&&c>r.ch&&p.charCodeAt(p.length-u-1)==m.charCodeAt(m.length-u-1);)c--,u++;a[a.length-1]=p.slice(0,p.length-u).replace(/^\u200b+/,""),a[0]=a[0].slice(c).replace(/\u200b+$/,"");i=O(e,c),l=O(o,s.length?R(s).length-u:0);return 1<a.length||a[0]||H(i,l)?(lo(t.doc,a,i,l,"+input"),!0):void 0},r.prototype.ensurePolled=function(){this.forceCompositionEnd()},r.prototype.reset=function(){this.forceCompositionEnd()},r.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},r.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},r.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||d(this.cm,function(){return W(e.cm)})},r.prototype.setUneditable=function(e){e.contentEditable="false"},r.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly())||P(this.cm,kl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},r.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},r.prototype.onContextMenu=function(){},r.prototype.resetPosition=function(){},r.prototype.needsContentAttribute=!0;function o(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new pe,this.hasSelection=!1,this.composing=null,this.resetting=!1}var Hl,Il,Wl,Pl,Rl;function l(e,t,i,n){Hl.defaults[e]=t,i&&(Il[e]=n?function(e,t,n){n!=pl&&i(e,t,n)}:i)}o.prototype.init=function(n){var e=this,i=this,r=this.cm,o=(this.createField(n),this.textarea);function t(e){if(!A(r,e)){if(r.somethingSelected())Cl({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=Tl(r);Cl({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,ve):(i.prevInput="",o.value=t.text.join("\n"),le(o))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}n.wrapper.insertBefore(this.wrapper,n.wrapper.firstChild),h&&(o.style.width="0px"),S(o,"input",function(){b&&9<=v&&e.hasSelection&&(e.hasSelection=null),i.poll()}),S(o,"paste",function(e){A(r,e)||Sl(e,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())}),S(o,"cut",t),S(o,"copy",t),S(n.scroller,"paste",function(e){var t;An(n,e)||A(r,e)||(o.dispatchEvent?((t=new Event("paste")).clipboardData=e.clipboardData,o.dispatchEvent(t)):(r.state.pasteIncoming=+new Date,i.focus()))}),S(n.lineSpace,"selectstart",function(e){An(n,e)||T(e)}),S(o,"compositionstart",function(){var e=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),S(o,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},o.prototype.createField=function(e){this.wrapper=Nl(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;Ml(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},o.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},o.prototype.prepareSelection=function(){var e,t=this.cm,n=t.display,i=t.doc,r=Ci(t);return t.options.moveInputWithCursor&&(t=ei(t,i.sel.primary().head,"div"),i=n.wrapper.getBoundingClientRect(),e=n.lineDiv.getBoundingClientRect(),r.teTop=Math.max(0,Math.min(n.wrapper.clientHeight-10,t.top+e.top-i.top)),r.teLeft=Math.max(0,Math.min(n.wrapper.clientWidth-10,t.left+e.left-i.left))),r},o.prototype.showSelection=function(e){var t=this.cm.display;y(t.cursorDiv,e.cursors),y(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},o.prototype.reset=function(e){var t,n;this.contextMenuPending||this.composing&&e||(t=this.cm,this.resetting=!0,t.somethingSelected()?(this.prevInput="",n=t.getSelection(),this.textarea.value=n,t.state.focused&&le(this.textarea),b&&9<=v&&(this.hasSelection=n)):e||(this.prevInput=this.textarea.value="",b&&9<=v&&(this.hasSelection=null)),this.resetting=!1)},o.prototype.getField=function(){return this.textarea},o.prototype.supportsTouch=function(){return!1},o.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!X||N(ce(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(e){}},o.prototype.blur=function(){this.textarea.blur()},o.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},o.prototype.receivedFocus=function(){this.slowPoll()},o.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},o.prototype.fastPoll=function(){var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,function e(){n.poll()||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))})},o.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||rt(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var r=n.value;if(r==i&&!t.somethingSelected())return!1;if(b&&9<=v&&this.hasSelection===r||C&&/[\uf700-\uf7ff]/.test(r))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=r.charCodeAt(0);if(8203==o&&(i=i||""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,a=Math.min(i.length,r.length);l<a&&i.charCodeAt(l)==r.charCodeAt(l);)++l;return d(t,function(){kl(t,r.slice(l),i.length-l,null,e.composing?"*compose":null),1e3<r.length||-1<r.indexOf("\n")?n.value=e.prevInput="":e.prevInput=r,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},o.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},o.prototype.onKeyPress=function(){b&&9<=v&&(this.hasSelection=null),this.fastPoll()},o.prototype.onContextMenu=function(e){var n,i,t,r,o=this,l=o.cm,a=l.display,s=o.textarea,c=(o.contextMenuPending&&o.contextMenuPending(),mi(l,e)),u=a.scroller.scrollTop;function d(){var e,t;null!=s.selectionStart&&(t=""+((e=l.somethingSelected())?s.value:""),s.value="⇚",s.value=t,o.prevInput=e?"":"",s.selectionStart=1,s.selectionEnd=t.length,a.selForContextMenu=l.doc.sel)}function h(){var e,t;o.contextMenuPending==h&&(o.contextMenuPending=!1,o.wrapper.style.cssText=i,s.style.cssText=n,b&&v<9&&a.scrollbars.setScrollTop(a.scroller.scrollTop=u),null!=s.selectionStart)&&((!b||v<9)&&d(),e=0,t=function(){a.selForContextMenu==l.doc.sel&&0==s.selectionStart&&0<s.selectionEnd&&""==o.prevInput?P(l,Jr)(l):e++<10?a.detectingSelectAll=setTimeout(t,500):(a.selForContextMenu=null,a.input.reset())},a.detectingSelectAll=setTimeout(t,200))}c&&!U&&(l.options.resetSelectionOnContextMenu&&-1==l.doc.sel.contains(c)&&P(l,j)(l.doc,yr(c),ve),n=s.style.cssText,i=o.wrapper.style.cssText,c=o.wrapper.offsetParent.getBoundingClientRect(),o.wrapper.style.cssText="position: static",s.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+"px;\n z-index: 1000; background: "+(b?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",w&&(t=s.ownerDocument.defaultView.scrollY),a.input.focus(),w&&s.ownerDocument.defaultView.scrollTo(null,t),a.input.reset(),l.somethingSelected()||(s.value=o.prevInput=" "),o.contextMenuPending=h,a.selForContextMenu=l.doc.sel,clearTimeout(a.detectingSelectAll),b&&9<=v&&d(),Z?(Ze(e),r=function(){L(window,"mouseup",r),setTimeout(h,20)},S(window,"mouseup",r)):setTimeout(h,50))},o.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},o.prototype.setUneditable=function(){},o.prototype.needsContentAttribute=!1,Il=(Hl=p).optionHandlers,Hl.defineOption=l,Hl.Init=pl,l("value","",function(e,t){return e.setValue(t)},!0),l("mode",null,function(e,t){e.doc.modeOption=t,kr(e)},!0),l("indentUnit",2,kr,!0),l("indentWithTabs",!1),l("smartIndent",!0),l("tabSize",4,function(e){Sr(e),$n(e),W(e)},!0),l("lineSeparator",null,function(e,i){if(e.doc.lineSep=i){var r=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var n=e.text.indexOf(i,t);if(-1==n)break;t=n+i.length,r.push(O(o,n))}o++});for(var t=r.length-1;0<=t;t--)lo(e.doc,i,r[t],O(r[t].line,r[t].ch+i.length))}}),l("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=pl&&e.refresh()}),l("specialCharPlaceholder",pn,function(e){return e.refresh()},!0),l("electricChars",!0),l("inputStyle",X?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),l("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),l("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),l("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),l("rtlMoveVisually",!s),l("wholeLineUpdateBefore",!0),l("theme","default",function(e){fl(e),ur(e)},!0),l("keyMap","default",function(e,t,n){t=jo(t),n=n!=pl&&jo(n);n&&n.detach&&n.detach(e,t),t.attach&&t.attach(e,n||null)}),l("extraKeys",null),l("configureMouse",null),l("lineWrapping",!1,yl,!0),l("gutters",[],function(e,t){e.display.gutterSpecs=sr(t,e.options.lineNumbers),ur(e)},!0),l("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?hi(e.display)+"px":"0",e.refresh()},!0),l("coverGutterNextToScrollbar",!1,function(e){return Gi(e)},!0),l("scrollbarStyle","native",function(e){Xi(e),Gi(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),l("lineNumbers",!1,function(e,t){e.display.gutterSpecs=sr(e.options.gutters,t),ur(e)},!0),l("firstLineNumber",1,ur,!0),l("lineNumberFormatter",function(e){return e},ur,!0),l("showCursorWhenSelecting",!1,wi,!0),l("resetSelectionOnContextMenu",!0),l("lineWiseCopyCut",!0),l("pasteLinesPerSelection",!0),l("selectionsMayTouch",!1),l("readOnly",!1,function(e,t){"nocursor"==t&&(Di(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),l("screenReaderLabel",null,function(e,t){e.display.input.screenReaderLabelChanged(t=""===t?null:t)}),l("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),l("dragDrop",!0,vl),l("allowDropFileTypes",null),l("cursorBlinkRate",530),l("cursorScrollMargin",0),l("cursorHeight",1,wi,!0),l("singleCursorHeightPerLine",!0,wi,!0),l("workTime",100),l("workDelay",100),l("flattenSpans",!0,Sr,!0),l("addModeClass",!1,Sr,!0),l("pollInterval",100),l("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),l("historyEventDelay",1250),l("viewportMargin",10,function(e){return e.refresh()},!0),l("maxHighlightLength",1e4,Sr,!0),l("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),l("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),l("autofocus",null),l("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),l("phrases",null),Pl=(Wl=p).optionHandlers,Rl=Wl.helpers={},Wl.prototype={constructor:Wl,focus:function(){ue(this).focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,i=n[e];n[e]==t&&"mode"!=e||(n[e]=t,Pl.hasOwnProperty(e)&&P(this,Pl[e])(this,t,i),D(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](jo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:n(function(e,t){var n=e.token?e:Wl.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");for(var i=this.state.overlays,n={mode:n,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},r=function(e){return e.priority},o=0,l=r(n);o<i.length&&r(i[o])<=l;)o++;i.splice(o,0,n),this.state.modeGen++,W(this)}),removeOverlay:n(function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var i=t[n].modeSpec;if(i==e||"string"==typeof e&&i.name==e)return t.splice(n,1),this.state.modeGen++,void W(this)}}),indentLine:n(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),bt(this.doc,e)&&bl(this,e,t,n)}),indentSelection:n(function(e){for(var t=this.doc.sel.ranges,n=-1,i=0;i<t.length;i++){var r=t[i];if(r.empty())r.head.line>n&&(bl(this,r.head.line,e,!0),n=r.head.line,i==this.doc.sel.primIndex)&&Ii(this);else{for(var o=r.from(),r=r.to(),l=Math.max(n,o.line),n=Math.min(this.lastLine(),r.line-(r.ch?0:1))+1,a=l;a<n;++a)bl(this,a,e);r=this.doc.sel.ranges;0==o.ch&&t.length==r.length&&0<r[i].from().ch&&_r(this.doc,i,new z(o,r[i].to()),ve)}}}),getTokenAt:function(e,t){return Pt(this,e,t)},getLineTokens:function(e,t){return Pt(this,O(e),t,!0)},getTokenTypeAt:function(e){e=I(this.doc,e);var t,n=Ft(this,F(this.doc,e.line)),i=0,r=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var l=i+r>>1;if((l?n[2*l-1]:0)>=o)r=l;else{if(!(n[2*l+1]<o)){t=n[2*l+2];break}i=1+l}}e=t?t.indexOf("overlay "):-1;return e<0?t:0==e?null:t.slice(0,e-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?Wl.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(Rl.hasOwnProperty(t)){var i=Rl[t],r=this.getModeAt(e);if("string"==typeof r[t])i[r[t]]&&n.push(i[r[t]]);else if(r[t])for(var o=0;o<r[t].length;o++){var l=i[r[t][o]];l&&n.push(l)}else r.helperType&&i[r.helperType]?n.push(i[r.helperType]):i[r.name]&&n.push(i[r.name]);for(var a=0;a<i._global.length;a++){var s=i._global[a];s.pred(r,this)&&-1==k(n,s.val)&&n.push(s.val)}}return n},getStateAfter:function(e,t){var n=this.doc;return Et(this,(e=Tt(n,null==e?n.first+n.size-1:e))+1,t).state},cursorCoords:function(e,t){var n=this.doc.sel.primary(),e=null==e?n.head:"object"==typeof e?I(this.doc,e):e?n.from():n.to();return ei(this,e,t||"page")},charCoords:function(e,t){return Jn(this,I(this.doc,e),t||"page")},coordsChar:function(e,t){return ii(this,(e=Qn(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Qn(this,{top:e,left:0},t||"page").top,xt(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var i=!1,r="number"==typeof e?(r=this.doc.first+this.doc.size-1,e<this.doc.first?e=this.doc.first:r<e&&(e=r,i=!0),F(this.doc,e)):e;return Zn(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-ln(r):0)},defaultTextHeight:function(){return ci(this.display)},defaultCharWidth:function(){return ui(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,i,r){var o,l,a=this.display,s=(e=ei(this,I(this.doc,e))).bottom,c=e.left;t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),a.sizer.appendChild(t),"over"==i?s=e.top:"above"!=i&&"near"!=i||(l=Math.max(a.wrapper.clientHeight,this.doc.height),o=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth),("above"==i||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?s=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(s=e.bottom),c+t.offsetWidth>o&&(c=o-t.offsetWidth)),t.style.top=s+"px",t.style.left=t.style.right="","right"==r?(c=a.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==r?c=0:"middle"==r&&(c=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),n&&(i=this,l={left:c,top:s,right:c+t.offsetWidth,bottom:s+t.offsetHeight},null!=(l=Oi(i,l)).scrollTop&&Bi(i,l.scrollTop),null!=l.scrollLeft)&&ji(i,l.scrollLeft)},triggerOnKeyDown:n(nl),triggerOnKeyPress:n(rl),triggerOnKeyUp:il,triggerOnMouseDown:n(sl),execCommand:function(e){if($o.hasOwnProperty(e))return $o[e].call(null,this)},triggerElectric:n(function(e){Ll(this,e)}),findPosH:function(e,t,n,i){for(var r=1,o=(t<0&&(r=-1,t=-t),I(this.doc,e)),l=0;l<t&&!(o=Dl(this.doc,o,r,n,i)).hitSide;++l);return o},moveH:n(function(t,n){var i=this;this.extendSelectionsBy(function(e){return i.display.shift||i.doc.extend||e.empty()?Dl(i.doc,e.head,t,n,i.options.rtlMoveVisually):t<0?e.from():e.to()},xe)}),deleteH:n(function(n,i){var e=this.doc.sel,r=this.doc;e.somethingSelected()?r.replaceSelection("",null,"+delete"):qo(this,function(e){var t=Dl(r,e.head,n,i,!1);return n<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,n,i){for(var r=1,o=i,l=(t<0&&(r=-1,t=-t),I(this.doc,e)),a=0;a<t;++a){var s=ei(this,l,"div");if(null==o?o=s.left:s.left=o,(l=Al(this,s,r,n)).hitSide)break}return l},moveV:n(function(i,r){var o=this,l=this.doc,a=[],s=!this.display.shift&&!l.extend&&l.sel.somethingSelected();if(l.extendSelectionsBy(function(e){var t,n;return s?i<0?e.from():e.to():(t=ei(o,e.head,"div"),null!=e.goalColumn&&(t.left=e.goalColumn),a.push(t.left),n=Al(o,t,i,r),"page"==r&&e==l.sel.primary()&&Hi(o,Jn(o,n,"div").top-t.top),n)},xe),a.length)for(var e=0;e<l.sel.ranges.length;e++)l.sel.ranges[e].goalColumn=a[e]}),findWordAt:function(e){var t=F(this.doc,e.line).text,n=e.ch,i=e.ch;if(t){for(var r=this.getHelper(e,"wordChars"),o=("before"!=e.sticky&&i!=t.length||!n?++i:--n,t.charAt(n)),l=Ne(o,r)?function(e){return Ne(e,r)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Ne(e)};0<n&&l(t.charAt(n-1));)--n;for(;i<t.length&&l(t.charAt(i));)++i}return new z(O(e.line,n),O(e.line,i))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||(((this.state.overwrite=!this.state.overwrite)?ie:J)(this.display.cursorDiv,"CodeMirror-overwrite"),D(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==N(se(this))},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:n(function(e,t){Wi(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Hn(this)-this.display.barHeight,width:e.scrollWidth-Hn(this)-this.display.barWidth,clientHeight:Wn(this),clientWidth:In(this)}},scrollIntoView:n(function(e,t){var n;null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:O(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?(t=e,Pi(n=this),n.curOp.scrollToPos=t):Ri(this,e.from,e.to,e.margin)}),setSize:n(function(e,t){function n(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var i=this,r=(null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Vn(this),this.display.viewFrom);this.doc.iter(r,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){vi(i,r,"widget");break}++r}),this.curOp.forceUpdate=!0,D(this,"refresh",this)}),operation:function(e){return d(this,e)},startOperation:function(){return Yi(this)},endOperation:function(){return Zi(this)},refresh:n(function(){var e=this.display.cachedTextHeight;W(this),this.curOp.forceUpdate=!0,$n(this),Wi(this,this.doc.scrollLeft,this.doc.scrollTop),rr(this.display),(null==e||.5<Math.abs(e-ci(this.display))||this.options.lineWrapping)&&pi(this),D(this,"refresh",this)}),swapDoc:n(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Nr(this,e),$n(this),this.display.input.reset(),Wi(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,x(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Xe(Wl),Wl.registerHelper=function(e,t,n){Rl.hasOwnProperty(e)||(Rl[e]=Wl[e]={_global:[]}),Rl[e][t]=n},Wl.registerGlobalHelper=function(e,t,n,i){Wl.registerHelper(e,t,i),Rl[e]._global.push({pred:n,val:i})};var Bl,zl="iter insert remove copy getEditor constructor".split(" ");for(Bl in f.prototype)f.prototype.hasOwnProperty(Bl)&&k(zl,Bl)<0&&(p.prototype[Bl]=function(e){return function(){return e.apply(this.doc,arguments)}}(f.prototype[Bl]));return Xe(f),p.inputStyles={textarea:o,contenteditable:r},p.defineMode=function(e){p.defaults.mode||"null"==e||(p.defaults.mode=e),function(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),at[e]=t}.apply(this,arguments)},p.defineMIME=function(e,t){st[e]=t},p.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),p.defineMIME("text/plain","null"),p.defineExtension=function(e,t){p.prototype[e]=t},p.defineDocExtension=function(e,t){f.prototype[e]=t},p.fromTextArea=function(t,n){var e;function i(){t.value=a.getValue()}if((n=n?he(n):{}).value=t.value,!n.tabindex&&t.tabIndex&&(n.tabindex=t.tabIndex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus&&(e=N(ce(t)),n.autofocus=e==t||null!=t.getAttribute("autofocus")&&e==document.body),t.form&&(S(t.form,"submit",i),!n.leaveSubmitMethodAlone)){var r=t.form,o=r.submit;try{var l=r.submit=function(){i(),r.submit=o,r.submit(),r.submit=l}}catch(e){}}n.finishInit=function(e){e.save=i,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,i(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(L(t.form,"submit",i),n.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=o))}},t.style.display="none";var a=p(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},n);return a},(t=p).off=L,t.on=S,t.wheelEventPixels=mr,t.Doc=f,t.splitLines=it,t.countColumn=fe,t.findColumn=be,t.isWordChar=Me,t.Pass=ge,t.signal=D,t.Line=cn,t.changeEnd=xr,t.scrollbarModel=$i,t.Pos=O,t.cmpPos=H,t.modes=at,t.mimeModes=st,t.resolveMode=ct,t.getMode=ut,t.modeExtensions=dt,t.extendMode=ht,t.copyState=ft,t.startState=mt,t.innerMode=pt,t.commands=$o,t.keyMap=Ho,t.keyName=zo,t.isModifierKey=Ro,t.lookupKey=Po,t.normalizeKeyMap=Wo,t.StringStream=m,t.SharedTextMarker=xo,t.TextMarker=go,t.LineWidget=po,t.e_preventDefault=T,t.e_stopPropagation=Ke,t.e_stop=Ze,t.addClass=ie,t.contains=ne,t.rmClass=J,t.keyNames=Ao,p.version="5.65.16",p},"object"==typeof n&&void 0!==t?t.exports=r():(i=i||self).CodeMirror=r()},{}],9:[function(e,t,n){var i;i=function(l){"use strict";var a=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;l.defineMode("gfm",function(e,i){var r=0;var t,n={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,t){var n;if(t.combineTokens=null,t.codeBlock)e.match(/^```+/)?t.codeBlock=!1:e.skipToEnd();else if(e.sol()&&(t.code=!1),e.sol()&&e.match(/^```+/))e.skipToEnd(),t.codeBlock=!0;else if("`"===e.peek())e.next(),n=e.pos,e.eatWhile("`"),n=1+e.pos-n,t.code?n===r&&(t.code=!1):(r=n,t.code=!0);else if(t.code)e.next();else if(e.eatSpace())t.ateSpace=!0;else{if((e.sol()||t.ateSpace)&&(t.ateSpace=!1)!==i.gitHubSpice){if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return t.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return t.combineTokens=!0,"link"}if(e.match(a)&&"]("!=e.string.slice(e.start-2,e.start)&&(0==e.start||/\W/.test(e.string.charAt(e.start-1))))return t.combineTokens=!0,"link";e.next()}return null},blankLine:function(e){return e.code=!1,null}},o={taskLists:!0,strikethrough:!0,emoji:!0};for(t in i)o[t]=i[t];return o.name="markdown",l.overlayMode(l.getMode(e,o),n)},"markdown"),l.defineMIME("text/x-gfm","gfm")},"object"==typeof n&&"object"==typeof t?i(e("../../lib/codemirror"),e("../markdown/markdown"),e("../../addon/mode/overlay")):i(CodeMirror)},{"../../addon/mode/overlay":6,"../../lib/codemirror":8,"../markdown/markdown":10}],10:[function(e,t,n){var i;i=function(E){"use strict";E.defineMode("markdown",function(h,f){var d=E.getMode(h,"text/html"),r="null"==d.name;void 0===f.highlightFormatting&&(f.highlightFormatting=!1),void 0===f.maxBlockquoteDepth&&(f.maxBlockquoteDepth=0),void 0===f.taskLists&&(f.taskLists=!1),void 0===f.strikethrough&&(f.strikethrough=!1),void 0===f.emoji&&(f.emoji=!1),void 0===f.fencedCodeBlockHighlighting&&(f.fencedCodeBlockHighlighting=!0),void 0===f.fencedCodeBlockDefaultMode&&(f.fencedCodeBlockDefaultMode="text/plain"),void 0===f.xml&&(f.xml=!0),void 0===f.tokenTypeOverrides&&(f.tokenTypeOverrides={});var e,p={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(e in p)p.hasOwnProperty(e)&&f.tokenTypeOverrides[e]&&(p[e]=f.tokenTypeOverrides[e]);var m=/^([*\-_])(?:\s*\1){2,}\s*$/,g=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,v=/^\[(x| )\](?=\s)/i,y=f.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,x=/^ {0,3}(?:\={1,}|-{2,})\s*$/,n=/^[^#!\[\]*_\\<>` "'(~:]+/,b=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,w=/^\s*\[[^\]]+?\]:.*$/,C=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/;function k(e,t,n){return(t.f=t.inline=n)(e,t)}function S(e,t,n){return(t.f=t.block=n)(e,t)}function i(e){var t;return e.linkTitle=!1,e.linkHref=!1,e.linkText=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,e.f==L&&(r||"xml"==(t=E.innerMode(d,e.htmlState)).mode.name&&null===t.state.tagStart&&!t.state.context&&t.state.tokenize.isInText)&&(e.f=N,e.block=o,e.htmlState=null),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine={stream:null},null}function o(e,t){var n=e.column()===t.indentation,i=!(i=t.prevLine.stream)||!/\S/.test(i.string),r=t.indentedCode,o=t.prevLine.hr,l=!1!==t.list,a=(t.listStack[t.listStack.length-1]||0)+3,s=(t.indentedCode=!1,t.indentation);if(null===t.indentationDiff&&(t.indentationDiff=t.indentation,l)){for(t.list=null;s<t.listStack[t.listStack.length-1];)t.listStack.pop(),t.listStack.length?t.indentation=t.listStack[t.listStack.length-1]:t.list=!1;!1!==t.list&&(t.indentationDiff=s-t.listStack[t.listStack.length-1])}var c,u=!(i||o||t.prevLine.header||l&&r||t.prevLine.fencedCodeEnd),o=(!1===t.list||o||i)&&t.indentation<=a&&e.match(m),d=null;return 4<=t.indentationDiff&&(r||t.prevLine.fencedCodeEnd||t.prevLine.header||i)?(e.skipToEnd(),t.indentedCode=!0,p.code):e.eatSpace()?null:n&&t.indentation<=a&&(d=e.match(y))&&d[1].length<=6?(t.quote=0,t.header=d[1].length,t.thisLine.header=!0,f.highlightFormatting&&(t.formatting="header"),t.f=t.inline,M(t)):t.indentation<=a&&e.eat(">")?(t.quote=n?1:t.quote+1,f.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),M(t)):!o&&!t.setext&&n&&t.indentation<=a&&(d=e.match(g))?(r=d[1]?"ol":"ul",t.indentation=s+e.current().length,t.list=!0,t.quote=0,t.listStack.push(t.indentation),t.em=!1,t.strong=!1,t.code=!1,t.strikethrough=!1,f.taskLists&&e.match(v,!1)&&(t.taskList=!0),t.f=t.inline,f.highlightFormatting&&(t.formatting=["list","list-"+r]),M(t)):n&&t.indentation<=a&&(d=e.match(b,!0))?(t.quote=0,t.fencedEndRE=new RegExp(d[1]+"+ *$"),t.localMode=f.fencedCodeBlockHighlighting&&(i=d[2]||f.fencedCodeBlockDefaultMode,E.findModeByName&&(c=E.findModeByName(i))&&(i=c.mime||c.mimes[0]),"null"==(c=E.getMode(h,i)).name?null:c),t.localMode&&(t.localState=E.startState(t.localMode)),t.f=t.block=T,f.highlightFormatting&&(t.formatting="code-block"),t.code=-1,M(t)):t.setext||!(u&&l||t.quote||!1!==t.list||t.code||o||w.test(e.string))&&(d=(d=e.lookAhead(1))&&d.match(x))?(t.setext?(t.header=t.setext,t.setext=0,e.skipToEnd(),f.highlightFormatting&&(t.formatting="header")):(t.header="="==d[0].charAt(0)?1:2,t.setext=t.header),t.thisLine.header=!0,t.f=t.inline,M(t)):o?(e.skipToEnd(),t.hr=!0,t.thisLine.hr=!0,p.hr):"["===e.peek()?k(e,t,F):k(e,t,t.inline)}function L(e,t){var n,i=d.token(e,t.htmlState);return!r&&("xml"==(n=E.innerMode(d,t.htmlState)).mode.name&&null===n.state.tagStart&&!n.state.context&&n.state.tokenize.isInText||t.md_inside&&-1<e.current().indexOf(">"))&&(t.f=N,t.block=o,t.htmlState=null),i}function T(e,t){var n,i=t.listStack[t.listStack.length-1]||0,r=t.indentation<i;return t.fencedEndRE&&t.indentation<=i+3&&(r||e.match(t.fencedEndRE))?(f.highlightFormatting&&(t.formatting="code-block"),r||(n=M(t)),t.localMode=t.localState=null,t.block=o,t.f=N,t.fencedEndRE=null,t.code=0,t.thisLine.fencedCodeEnd=!0,r?S(e,t,t.block):n):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),p.code)}function M(e){var t,n=[];if(e.formatting){n.push(p.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var i=0;i<e.formatting.length;i++)n.push(p.formatting+"-"+e.formatting[i]),"header"===e.formatting[i]&&n.push(p.formatting+"-"+e.formatting[i]+"-"+e.header),"quote"===e.formatting[i]&&(!f.maxBlockquoteDepth||f.maxBlockquoteDepth>=e.quote?n.push(p.formatting+"-"+e.formatting[i]+"-"+e.quote):n.push("error"))}return e.taskOpen?n.push("meta"):e.taskClosed?n.push("property"):(e.linkHref?n.push(p.linkHref,"url"):(e.strong&&n.push(p.strong),e.em&&n.push(p.em),e.strikethrough&&n.push(p.strikethrough),e.emoji&&n.push(p.emoji),e.linkText&&n.push(p.linkText),e.code&&n.push(p.code),e.image&&n.push(p.image),e.imageAltText&&n.push(p.imageAltText,"link"),e.imageMarker&&n.push(p.imageMarker)),e.header&&n.push(p.header,p.header+"-"+e.header),e.quote&&(n.push(p.quote),!f.maxBlockquoteDepth||f.maxBlockquoteDepth>=e.quote?n.push(p.quote+"-"+e.quote):n.push(p.quote+"-"+f.maxBlockquoteDepth)),!1!==e.list&&(t=(e.listStack.length-1)%3,n.push(t?1==t?p.list2:p.list3:p.list1)),e.trailingSpaceNewLine?n.push("trailing-space-new-line"):e.trailingSpace&&n.push("trailing-space-"+(e.trailingSpace%2?"a":"b"))),n.length?n.join(" "):null}function t(e,t){if(e.match(n,!0))return M(t)}function N(e,t){var n=t.text(e,t);if(void 0!==n)return n;if(t.list)t.list=null;else if(t.taskList)" "===e.match(v,!0)[1]?t.taskOpen=!0:t.taskClosed=!0,f.highlightFormatting&&(t.formatting="task"),t.taskList=!1;else if(t.taskOpen=!1,t.taskClosed=!1,t.header&&e.match(/^#+$/,!0))f.highlightFormatting&&(t.formatting="header");else{var i=e.next();if(t.linkTitle){t.linkTitle=!1;var n=((n="("===i?")":i)+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");if(e.match(new RegExp("^\\s*(?:[^"+n+"\\\\]+|\\\\\\\\|\\\\.)"+n),!0))return p.linkHref}if("`"===i)return n=t.formatting,f.highlightFormatting&&(t.formatting="code"),e.eatWhile("`"),a=e.current().length,0!=t.code||t.quote&&1!=a?a==t.code?(l=M(t),t.code=0,l):(t.formatting=n,M(t)):(t.code=a,M(t));if(!t.code){if("\\"===i)if(e.next(),f.highlightFormatting)return o=M(t),n=p.formatting+"-escape",o?o+" "+n:n;if("!"===i&&e.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))t.imageMarker=!0,t.image=!0,f.highlightFormatting&&(t.formatting="image");else if("["===i&&t.imageMarker&&e.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))t.imageMarker=!1,t.imageAltText=!0,f.highlightFormatting&&(t.formatting="image");else{if("]"===i&&t.imageAltText)return f.highlightFormatting&&(t.formatting="image"),o=M(t),t.imageAltText=!1,t.image=!1,t.inline=t.f=A,o;if("["!==i||t.image){if("]"===i&&t.linkText)return f.highlightFormatting&&(t.formatting="link"),o=M(t),t.linkText=!1,t.inline=t.f=e.match(/\(.*?\)| ?\[.*?\]/,!1)?A:N,o;if("<"===i&&e.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=D,f.highlightFormatting&&(t.formatting="link"),(o=M(t))?o+=" ":o="",o+p.linkInline;if("<"===i&&e.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return t.f=t.inline=D,f.highlightFormatting&&(t.formatting="link"),(o=M(t))?o+=" ":o="",o+p.linkEmail;if(f.xml&&"<"===i&&e.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1))return-1!=(a=e.string.indexOf(">",e.pos))&&(n=e.string.substring(e.start,a),/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(n))&&(t.md_inside=!0),e.backUp(1),t.htmlState=E.startState(d),S(e,t,L);if(f.xml&&"<"===i&&e.match(/^\/\w*?>/))return t.md_inside=!1,"tag";if("*"===i||"_"===i){for(var r=1,o=1==e.pos?" ":e.string.charAt(e.pos-2);r<3&&e.eat(i);)r++;var l,a=e.peek()||" ",n=!/\s/.test(a)&&(!C.test(a)||/\s/.test(o)||C.test(o)),s=!/\s/.test(o)&&(!C.test(o)||/\s/.test(a)||C.test(a)),c=null,u=null;if(r%2&&(t.em||!n||"*"!==i&&s&&!C.test(o)?t.em!=i||!s||"*"!==i&&n&&!C.test(a)||(c=!1):c=!0),1<r&&(t.strong||!n||"*"!==i&&s&&!C.test(o)?t.strong!=i||!s||"*"!==i&&n&&!C.test(a)||(u=!1):u=!0),null!=u||null!=c)return f.highlightFormatting&&(t.formatting=null==c?"strong":null==u?"em":"strong em"),!0===c&&(t.em=i),!0===u&&(t.strong=i),l=M(t),!1===c&&(t.em=!1),!1===u&&(t.strong=!1),l}else if(" "===i&&(e.eat("*")||e.eat("_"))){if(" "===e.peek())return M(t);e.backUp(1)}if(f.strikethrough)if("~"===i&&e.eatWhile(i)){if(t.strikethrough)return f.highlightFormatting&&(t.formatting="strikethrough"),l=M(t),t.strikethrough=!1,l;if(e.match(/^[^\s]/,!1))return t.strikethrough=!0,f.highlightFormatting&&(t.formatting="strikethrough"),M(t)}else if(" "===i&&e.match("~~",!0)){if(" "===e.peek())return M(t);e.backUp(2)}if(f.emoji&&":"===i&&e.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/))return t.emoji=!0,f.highlightFormatting&&(t.formatting="emoji"),o=M(t),t.emoji=!1,o;" "===i&&(e.match(/^ +$/,!1)?t.trailingSpace++:t.trailingSpace&&(t.trailingSpaceNewLine=!0))}else t.linkText&&e.match(/^.*?\]/)||(t.linkText=!0,f.highlightFormatting&&(t.formatting="link"))}}}return M(t)}function D(e,t){return">"===e.next()?(t.f=t.inline=N,f.highlightFormatting&&(t.formatting="link"),(t=M(t))?t+=" ":t="",t+p.linkInline):(e.match(/^[^>]+/,!0),p.linkInline)}function A(e,t){var i;return e.eatSpace()?null:"("===(e=e.next())||"["===e?(t.f=t.inline=(i="("===e?")":"]",function(e,t){var n;return e.next()===i?(t.f=t.inline=N,f.highlightFormatting&&(t.formatting="link-string"),n=M(t),t.linkHref=!1,n):(e.match(l[i]),t.linkHref=!0,M(t))}),f.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,M(t)):"error"}var l={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function F(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=a,e.next(),f.highlightFormatting&&(t.formatting="link"),t.linkText=!0,M(t)):k(e,t,N)}function a(e,t){var n;return e.match("]:",!0)?(t.f=t.inline=s,f.highlightFormatting&&(t.formatting="link"),n=M(t),t.linkText=!1,n):(e.match(/^([^\]\\]|\\.)+/,!0),p.linkText)}function s(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),t.f=t.inline=N,p.linkHref+" url")}var c={startState:function(){return{f:o,prevLine:{stream:null},thisLine:{stream:null},block:o,htmlState:null,indentation:0,inline:N,text:t,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(e){return{f:e.f,prevLine:e.prevLine,thisLine:e.thisLine,block:e.block,htmlState:e.htmlState&&E.copyState(d,e.htmlState),indentation:e.indentation,localMode:e.localMode,localState:e.localMode?E.copyState(e.localMode,e.localState):null,inline:e.inline,text:e.text,formatting:!1,linkText:e.linkText,linkTitle:e.linkTitle,linkHref:e.linkHref,code:e.code,em:e.em,strong:e.strong,strikethrough:e.strikethrough,emoji:e.emoji,header:e.header,setext:e.setext,hr:e.hr,taskList:e.taskList,list:e.list,listStack:e.listStack.slice(0),quote:e.quote,indentedCode:e.indentedCode,trailingSpace:e.trailingSpace,trailingSpaceNewLine:e.trailingSpaceNewLine,md_inside:e.md_inside,fencedEndRE:e.fencedEndRE}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine.stream){if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0))return i(t),null;if(t.prevLine=t.thisLine,t.thisLine={stream:e},t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,!t.localState&&(t.f=t.block,t.f!=L)){var n=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(t.indentation=n,t.indentationDiff=null,0<n)return null}}return t.f(e,t)},innerMode:function(e){return e.block==L?{state:e.htmlState,mode:d}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:c}},indent:function(e,t,n){return e.block==L&&d.indent?d.indent(e.htmlState,t,n):e.localState&&e.localMode.indent?e.localMode.indent(e.localState,t,n):E.Pass},blankLine:i,getType:M,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return c},"xml"),E.defineMIME("text/markdown","markdown"),E.defineMIME("text/x-markdown","markdown")},"object"==typeof n&&"object"==typeof t?i(e("../../lib/codemirror"),e("../xml/xml"),e("../meta")):i(CodeMirror)},{"../../lib/codemirror":8,"../meta":11,"../xml/xml":12}],11:[function(e,t,n){(function(r){"use strict";r.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","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{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","f95"]},{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:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["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","wl","wls"]},{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"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["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:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{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"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var e=0;e<r.modeInfo.length;e++){var t=r.modeInfo[e];t.mimes&&(t.mime=t.mimes[0])}r.findModeByMIME=function(e){e=e.toLowerCase();for(var t=0;t<r.modeInfo.length;t++){var n=r.modeInfo[t];if(n.mime==e)return n;if(n.mimes)for(var i=0;i<n.mimes.length;i++)if(n.mimes[i]==e)return n}return/\+xml$/.test(e)?r.findModeByMIME("application/xml"):/\+json$/.test(e)?r.findModeByMIME("application/json"):void 0},r.findModeByExtension=function(e){e=e.toLowerCase();for(var t=0;t<r.modeInfo.length;t++){var n=r.modeInfo[t];if(n.ext)for(var i=0;i<n.ext.length;i++)if(n.ext[i]==e)return n}},r.findModeByFileName=function(e){for(var t=0;t<r.modeInfo.length;t++){var n=r.modeInfo[t];if(n.file&&n.file.test(e))return n}var i=e.lastIndexOf("."),i=-1<i&&e.substring(i+1,e.length);if(i)return r.findModeByExtension(i)},r.findModeByName=function(e){e=e.toLowerCase();for(var t=0;t<r.modeInfo.length;t++){var n=r.modeInfo[t];if(n.name.toLowerCase()==e)return n;if(n.alias)for(var i=0;i<n.alias.length;i++)if(n.alias[i].toLowerCase()==e)return n}}})("object"==typeof n&&"object"==typeof t?e("../lib/codemirror"):CodeMirror)},{"../lib/codemirror":8}],12:[function(e,t,n){(function(S){"use strict";var L={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},T={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};S.defineMode("xml",function(e,t){var n,l,o,a=e.indentUnit,s={},i=t.htmlMode?L:T;for(n in i)s[n]=i[n];for(n in t)s[n]=t[n];function c(t,n){function e(e){return(n.tokenize=e)(t,n)}var i=t.next();return"<"==i?t.eat("!")?t.eat("[")?t.match("CDATA[")?e(r("atom","]]>")):null:t.match("--")?e(r("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),e(function i(r){return function(e,t){for(var n;null!=(n=e.next());){if("<"==n)return t.tokenize=i(r+1),t.tokenize(e,t);if(">"==n){if(1!=r)return t.tokenize=i(r-1),t.tokenize(e,t);t.tokenize=c;break}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),n.tokenize=r("meta","?>"),"meta"):(l=t.eat("/")?"closeTag":"openTag",n.tokenize=u,"tag bracket"):"&"==i?(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error":(t.eatWhile(/[^&<]/),null)}function u(e,t){var n,i,r=e.next();return">"==r||"/"==r&&e.eat(">")?(t.tokenize=c,l=">"==r?"endTag":"selfcloseTag","tag bracket"):"="==r?(l="equals",null):"<"==r?(t.tokenize=c,t.state=m,t.tagName=t.tagStart=null,(n=t.tokenize(e,t))?n+" tag error":"tag error"):/[\'\"]/.test(r)?(t.tokenize=(i=r,o.isInAttribute=!0,o),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word");function o(e,t){for(;!e.eol();)if(e.next()==i){t.tokenize=u;break}return"string"}}function r(n,i){return function(e,t){for(;!e.eol();){if(e.match(i)){t.tokenize=c;break}e.next()}return n}}function d(e){return e&&e.toLowerCase()}function h(e,t,n){this.prev=e.context,this.tagName=t||"",this.indent=e.indented,this.startOfLine=n,(s.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function f(e){e.context&&(e.context=e.context.prev)}function p(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!s.contextGrabbers.hasOwnProperty(d(n))||!s.contextGrabbers[d(n)].hasOwnProperty(d(t)))return;f(e)}}function m(e,t,n){return"openTag"==e?(n.tagStart=t.column(),g):"closeTag"==e?v:m}function g(e,t,n){return"word"==e?(n.tagName=t.current(),o="tag",b):s.allowMissingTagName&&"endTag"==e?(o="tag bracket",b(e,0,n)):(o="error",g)}function v(e,t,n){var i;return"word"==e?(i=t.current(),n.context&&n.context.tagName!=i&&s.implicitlyClosed.hasOwnProperty(d(n.context.tagName))&&f(n),n.context&&n.context.tagName==i||!1===s.matchClosing?(o="tag",y):(o="tag error",x)):s.allowMissingTagName&&"endTag"==e?(o="tag bracket",y(e,0,n)):(o="error",x)}function y(e,t,n){return"endTag"!=e?(o="error",y):(f(n),m)}function x(e,t,n){return o="error",y(e,0,n)}function b(e,t,n){var i,r;return"word"==e?(o="attribute",w):"endTag"==e||"selfcloseTag"==e?(i=n.tagName,r=n.tagStart,n.tagName=n.tagStart=null,"selfcloseTag"==e||s.autoSelfClosers.hasOwnProperty(d(i))?p(n,i):(p(n,i),n.context=new h(n,i,r==n.indented)),m):(o="error",b)}function w(e,t,n){return"equals"==e?C:(s.allowMissing||(o="error"),b(e,0,n))}function C(e,t,n){return"string"==e?k:"word"==e&&s.allowUnquoted?(o="string",b):(o="error",b(e,0,n))}function k(e,t,n){return"string"==e?k:b(e,0,n)}return c.isInText=!0,{startState:function(e){var t={tokenize:c,state:m,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;l=null;var n=t.tokenize(e,t);return n=(n||l)&&"comment"!=n&&(o=null,t.state=t.state(l||n,e,t),o)?"error"==o?n+" error":o:n},indent:function(e,t,n){var i=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+a;if(i&&i.noIndent)return S.Pass;if(e.tokenize!=u&&e.tokenize!=c)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==s.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+a*(s.multilineTagIndentFactor||1);if(s.alignCDATA&&/<!\[CDATA\[/.test(t))return 0;var r=t&&/^<(\/)?([\w_:\.-]*)/.exec(t);if(r&&r[1])for(;i;){if(i.tagName==r[2]){i=i.prev;break}if(!s.implicitlyClosed.hasOwnProperty(d(i.tagName)))break;i=i.prev}else if(r)for(;i;){var o=s.contextGrabbers[d(i.tagName)];if(!o||!o.hasOwnProperty(d(r[2])))break;i=i.prev}for(;i&&i.prev&&!i.startOfLine;)i=i.prev;return i?i.indent+a:e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:s.htmlMode?"html":"xml",helperType:s.htmlMode?"html":"xml",skipAttribute:function(e){e.state==C&&(e.state=b)},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:"closeTag"==e.type}:null},xmlCurrentContext:function(e){for(var t=[],n=e.context;n;n=n.prev)t.push(n.tagName);return t.reverse()}}}),S.defineMIME("text/xml","xml"),S.defineMIME("application/xml","xml"),S.mimeModes.hasOwnProperty("text/html")||S.defineMIME("text/html",{name:"xml",htmlMode:!0})})("object"==typeof n&&"object"==typeof t?e("../../lib/codemirror"):CodeMirror)},{"../../lib/codemirror":8}],13:[function(o,t,e){!function(p){!function(){var e;!function(){"use strict";(e=function(e,r,o,l){l=l||{},this.dictionary=null,this.rules={},this.dictionaryTable={},this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=l.flags||{},this.memoized={},this.loaded=!1;var t,a,s,c,u,d=this;function n(e,t){e=d._readFile(e,null,l.asyncLoad);l.asyncLoad?e.then(function(e){t(e)}):t(e)}function i(e){r=e,o&&f()}function h(e){o=e,r&&f()}function f(){for(d.rules=d._parseAFF(r),d.compoundRuleCodes={},a=0,c=d.compoundRules.length;a<c;a++){var e=d.compoundRules[a];for(s=0,u=e.length;s<u;s++)d.compoundRuleCodes[e[s]]=[]}for(a in"ONLYINCOMPOUND"in d.flags&&(d.compoundRuleCodes[d.flags.ONLYINCOMPOUND]=[]),d.dictionaryTable=d._parseDIC(o),d.compoundRuleCodes)0===d.compoundRuleCodes[a].length&&delete d.compoundRuleCodes[a];for(a=0,c=d.compoundRules.length;a<c;a++){var t=d.compoundRules[a],n="";for(s=0,u=t.length;s<u;s++){var i=t[s];i in d.compoundRuleCodes?n+="("+d.compoundRuleCodes[i].join("|")+")":n+=i}d.compoundRules[a]=new RegExp(n,"i")}d.loaded=!0,l.asyncLoad&&l.loadedCallback&&l.loadedCallback(d)}return e&&(d.dictionary=e,r&&o?f():"undefined"!=typeof window&&"chrome"in window&&"extension"in window.chrome&&"getURL"in window.chrome.extension?(t=l.dictionaryPath||"typo/dictionaries",r||n(chrome.extension.getURL(t+"/"+e+"/"+e+".aff"),i),o||n(chrome.extension.getURL(t+"/"+e+"/"+e+".dic"),h)):(t=l.dictionaryPath||(void 0!==p?p+"/dictionaries":"./dictionaries"),r||n(t+"/"+e+"/"+e+".aff",i),o||n(t+"/"+e+"/"+e+".dic",h))),this}).prototype={load:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);return this},_readFile:function(e,t,n){var i,r;if(t=t||"utf8","undefined"!=typeof XMLHttpRequest)return(r=new XMLHttpRequest).open("GET",e,n),n&&(i=new Promise(function(e,t){r.onload=function(){200===r.status?e(r.responseText):t(r.statusText)},r.onerror=function(){t(r.statusText)}})),r.overrideMimeType&&r.overrideMimeType("text/plain; charset="+t),r.send(null),n?i:r.responseText;if(void 0!==o){n=o("fs");try{if(n.existsSync(e))return n.readFileSync(e,t);console.log("Path "+e+" does not exist.")}catch(e){return console.log(e),""}}},_parseAFF:function(e){for(var t,n={},i=e.split(/\r?\n/),r=0,o=i.length;r<o;r++)if(t=(t=this._removeAffixComments(i[r])).trim()){var l=t.split(/\s+/),a=l[0];if("PFX"==a||"SFX"==a){for(var s,c=l[1],u=l[2],d=[],h=r+1,f=r+1+(s=parseInt(l[3],10));h<f;h++){var p,m=(p=i[h].split(/\s+/))[2],g=p[3].split("/"),v=g[0],g=("0"===v&&(v=""),this.parseRuleCodes(g[1])),y=p[4],x={};x.add=v,0<g.length&&(x.continuationClasses=g),"."!==y&&(x.match="SFX"===a?new RegExp(y+"$"):new RegExp("^"+y)),"0"!=m&&(x.remove="SFX"===a?new RegExp(m+"$"):m),d.push(x)}n[c]={type:a,combineable:"Y"==u,entries:d},r+=s}else if("COMPOUNDRULE"===a){for(f=(h=r+1)+(s=parseInt(l[1],10));h<f;h++)p=(t=i[h]).split(/\s+/),this.compoundRules.push(p[1]);r+=s}else"REP"===a?3===(p=t.split(/\s+/)).length&&this.replacementTable.push([p[1],p[2]]):this.flags[a]=l[1]}return n},_removeAffixComments:function(e){return e.match(/^\s*#/,"")?"":e},_parseDIC:function(e){var t=(e=this._removeDicComments(e)).split(/\r?\n/),n={};function i(e,t){n.hasOwnProperty(e)||(n[e]=null),0<t.length&&(null===n[e]&&(n[e]=[]),n[e].push(t))}for(var r=1,o=t.length;r<o;r++){var l=t[r];if(l){var l=l.split("/",2),a=l[0];if(1<l.length){var s=this.parseRuleCodes(l[1]);"NEEDAFFIX"in this.flags&&-1!=s.indexOf(this.flags.NEEDAFFIX)||i(a,s);for(var c=0,u=s.length;c<u;c++){var d=s[c],h=this.rules[d];if(h)for(var f=this._applyRule(a,h),p=0,m=f.length;p<m;p++){var g=f[p];if(i(g,[]),h.combineable)for(var v=c+1;v<u;v++){var y=s[v],y=this.rules[y];if(y&&y.combineable&&h.type!=y.type)for(var x=this._applyRule(g,y),b=0,w=x.length;b<w;b++)i(x[b],[])}}d in this.compoundRuleCodes&&this.compoundRuleCodes[d].push(a)}}else i(a.trim(),[])}}return n},_removeDicComments:function(e){return e=e.replace(/^\t.*$/gm,"")},parseRuleCodes:function(e){if(e){if("FLAG"in this.flags){if("long"!==this.flags.FLAG)return"num"===this.flags.FLAG?e.split(","):"UTF-8"===this.flags.FLAG?Array.from(e):e.split("");for(var t=[],n=0,i=e.length;n<i;n+=2)t.push(e.substr(n,2));return t}return e.split("")}return[]},_applyRule:function(e,t){for(var n=t.entries,i=[],r=0,o=n.length;r<o;r++){var l=n[r];if(!l.match||e.match(l.match)){var a=e;if(l.remove&&(a=a.replace(l.remove,"")),"SFX"===t.type?a+=l.add:a=l.add+a,i.push(a),"continuationClasses"in l)for(var s=0,c=l.continuationClasses.length;s<c;s++){var u=this.rules[l.continuationClasses[s]];u&&(i=i.concat(this._applyRule(a,u)))}}}return i},check:function(e){if(!this.loaded)throw"Dictionary not loaded.";if(e){e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(this.checkExact(e))return!0;if(e.toUpperCase()===e){var t=e[0]+e.substring(1).toLowerCase();if(this.hasFlag(t,"KEEPCASE"))return!1;if(this.checkExact(t))return!0;if(this.checkExact(e.toLowerCase()))return!0}t=e[0].toLowerCase()+e.substring(1);if(t!==e){if(this.hasFlag(t,"KEEPCASE"))return!1;if(this.checkExact(t))return!0}}return!1},checkExact:function(e){if(!this.loaded)throw"Dictionary not loaded.";var t,n,i=this.dictionaryTable[e];if(void 0===i){if("COMPOUNDMIN"in this.flags&&e.length>=this.flags.COMPOUNDMIN)for(t=0,n=this.compoundRules.length;t<n;t++)if(e.match(this.compoundRules[t]))return!0}else{if(null===i)return!0;if("object"==typeof i)for(t=0,n=i.length;t<n;t++)if(!this.hasFlag(e,"ONLYINCOMPOUND",i[t]))return!0}return!1},hasFlag:function(e,t,n){if(this.loaded)return!!(t in this.flags&&(n=void 0===n?Array.prototype.concat.apply([],this.dictionaryTable[e]):n)&&-1!==n.indexOf(this.flags[t]));throw"Dictionary not loaded."},alphabet:"",suggest:function(e,c){if(!this.loaded)throw"Dictionary not loaded.";if(c=c||5,this.memoized.hasOwnProperty(e)){var t=this.memoized[e].limit;if(c<=t||this.memoized[e].suggestions.length<t)return this.memoized[e].suggestions.slice(0,c)}if(this.check(e))return[];for(var n=0,i=this.replacementTable.length;n<i;n++){var r=this.replacementTable[n];if(-1!==e.indexOf(r[0])){r=e.replace(r[0],r[1]);if(this.check(r))return[r]}}if(!this.alphabet){this.alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ","TRY"in this.flags&&(this.alphabet+=this.flags.TRY),"WORDCHARS"in this.flags&&(this.alphabet+=this.flags.WORDCHARS);for(var o=this.alphabet.split(""),l=(o.sort(),{}),n=0;n<o.length;n++)l[o[n]]=!0;for(n in this.alphabet="",l)this.alphabet+=n}var h=this;function u(e,t){var n,i,r,o,l={},a=h.alphabet.length;for(o in"string"==typeof e&&(o=e,(e={})[o]=!0),e)for(n=0,i=o.length+1;n<i;n++){var s=[o.substring(0,n),o.substring(n)];if(s[1]&&(r=s[0]+s[1].substring(1),t&&!h.check(r)||(r in l?l[r]+=1:l[r]=1)),1<s[1].length&&s[1][1]!==s[1][0]&&(r=s[0]+s[1][1]+s[1][0]+s[1].substring(2),t&&!h.check(r)||(r in l?l[r]+=1:l[r]=1)),s[1])for(var c=s[1].substring(0,1).toUpperCase()===s[1].substring(0,1)?"uppercase":"lowercase",u=0;u<a;u++){var d=h.alphabet[u];(d="uppercase"===c?d.toUpperCase():d)!=s[1].substring(0,1)&&(r=s[0]+d+s[1].substring(1),t&&!h.check(r)||(r in l?l[r]+=1:l[r]=1))}if(s[1])for(u=0;u<a;u++){c=s[0].substring(-1).toUpperCase()===s[0].substring(-1)&&s[1].substring(0,1).toUpperCase()===s[1].substring(0,1)?"uppercase":"lowercase",d=h.alphabet[u];"uppercase"===c&&(d=d.toUpperCase()),r=s[0]+d+s[1],t&&!h.check(r)||(r in l?l[r]+=1:l[r]=1)}}return l}return this.memoized[e]={suggestions:function(e){var t,n=u(e),i=u(n,!0);for(t in n)h.check(t)&&(t in i?i[t]+=n[t]:i[t]=n[t]);var r=[];for(s in i)i.hasOwnProperty(s)&&r.push([s,i[s]]);r.sort(function(e,t){var n=e[1],i=t[1];return n<i?-1:i<n?1:t[0].localeCompare(e[0])}).reverse();for(var o=[],l="lowercase",a=(e.toUpperCase()===e?l="uppercase":e.substr(0,1).toUpperCase()+e.substr(1).toLowerCase()===e&&(l="capitalized"),c),s=0;s<Math.min(a,r.length);s++)"uppercase"===l?r[s][0]=r[s][0].toUpperCase():"capitalized"===l&&(r[s][0]=r[s][0].substr(0,1).toUpperCase()+r[s][0].substr(1)),h.hasFlag(r[s][0],"NOSUGGEST")||-1!=o.indexOf(r[s][0])?a++:o.push(r[s][0]);return o}(e),limit:c},this.memoized[e].suggestions}}}(),void 0!==t&&(t.exports=e)}.call(this)}.call(this,"/node_modules/typo-js")},{fs:1}],14:[function(e,t,n){e=e("codemirror");e.commands.tabAndIndentMarkdownList=function(e){var t=e.listSelections()[0].head;!1!==e.getStateAfter(t.line).list?e.execCommand("indentMore"):e.options.indentWithTabs?e.execCommand("insertTab"):(t=Array(e.options.tabSize+1).join(" "),e.replaceSelection(t))},e.commands.shiftTabAndUnindentMarkdownList=function(e){var t=e.listSelections()[0].head;!1!==e.getStateAfter(t.line).list?e.execCommand("indentLess"):e.options.indentWithTabs?e.execCommand("insertTab"):(t=Array(e.options.tabSize+1).join(" "),e.replaceSelection(t))}},{codemirror:8}],15:[function(e,W,P){"use strict";var c=e("codemirror"),R=(e("codemirror/addon/edit/continuelist.js"),e("./codemirror/tablist"),e("codemirror/addon/display/fullscreen.js"),e("codemirror/mode/markdown/markdown.js"),e("codemirror/addon/mode/overlay.js"),e("codemirror/addon/display/placeholder.js"),e("codemirror/addon/selection/mark-selection.js"),e("codemirror/mode/gfm/gfm.js"),e("codemirror/mode/xml/xml.js"),e("codemirror-spell-checker")),r=/Mac/.test(navigator.platform),u={toggleBold:t,toggleItalic:n,drawLink:w,toggleHeadingSmaller:s,toggleHeadingBigger:p,drawImage:C,toggleBlockquote:a,toggleOrderedList:x,toggleUnorderedList:y,toggleCodeBlock:l,togglePreview:N,toggleStrikethrough:o,toggleHeading1:m,toggleHeading2:g,toggleHeading3:v,cleanBlock:b,drawTable:k,drawHorizontalRule:S,undo:L,redo:T,toggleSideBySide:M,toggleFullScreen:f},B={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},z=function(e){for(var t in u)if(u[t]===e)return t;return null};function d(e){return e=r?e.replace("Ctrl","Cmd"):e.replace("Cmd","Ctrl")}function j(e,t,n){e=e||{};var i=document.createElement("a");return t=null==t||t,e.title&&t&&(i.title=function(e,t,n){t&&(t=z(t),n[t])&&(e+=" ("+d(n[t])+")");return e}(e.title,e.action,n),r)&&(i.title=i.title.replace("Ctrl","⌘"),i.title=i.title.replace("Alt","⌥")),i.tabIndex=-1,i.className=e.className,i}function h(e,t){t=t||e.getCursor("start");var n=e.getTokenAt(t);if(!n.type)return{};for(var i,r,o=n.type.split(" "),l={},a=0;a<o.length;a++)"strong"===(i=o[a])?l.bold=!0:"variable-2"===i?(r=e.getLine(t.line),/^\s*\d+\.\s/.test(r)?l["ordered-list"]=!0:l["unordered-list"]=!0):"atom"===i?l.quote=!0:"em"===i?l.italic=!0:"quote"===i?l.quote=!0:"strikethrough"===i?l.strikethrough=!0:"comment"===i?l.code=!0:"link"===i?l.link=!0:"tag"===i?l.image=!0:i.match(/^header(\-[1-6])?$/)&&(l[i.replace("header","heading")]=!0);return l}var i="";function f(e){var t=e.codemirror,n=(t.setOption("fullScreen",!t.getOption("fullScreen")),t.getOption("fullScreen")?(i=document.body.style.overflow,document.body.style.overflow="hidden"):document.body.style.overflow=i,t.getWrapperElement()),n=(/fullscreen/.test(n.previousSibling.className)?n.previousSibling.className=n.previousSibling.className.replace(/\s*fullscreen\b/,""):n.previousSibling.className+=" fullscreen",e.toolbarElements.fullscreen),n=(/active/.test(n.className)?n.className=n.className.replace(/\s*active\s*/g,""):n.className+=" active",t.getWrapperElement().nextSibling);/editor-preview-active-side/.test(n.className)&&M(e)}function t(e){E(e,"bold",e.options.blockStyles.bold)}function n(e){E(e,"italic",e.options.blockStyles.italic)}function o(e){E(e,"strikethrough","~~")}function l(e){var t=e.options.blockStyles.code;function o(e){if("object"!=typeof e)throw"fencing_line() takes a 'line' object (not a line number, or line text). Got: "+typeof e+": "+e;return e.styles&&e.styles[2]&&-1!==e.styles[2].indexOf("formatting-code-block")}function l(e){return e.state.base.base||e.state.base}function n(e,t,n,i,r){n=n||e.getLineHandle(t),i=i||e.getTokenAt({line:t,ch:1}),r=r||!!n.text&&e.getTokenAt({line:t,ch:n.text.length-1});e=i.type?i.type.split(" "):[];return r&&l(r).indentedCode?"indented":-1!==e.indexOf("comment")&&(l(i).fencedChars||l(r).fencedChars||o(n)?"fenced":"single")}var i,r,a,s,c=e.codemirror,e=c.getCursor("start"),u=c.getCursor("end"),d=c.getTokenAt({line:e.line,ch:e.ch||1}),h=c.getLineHandle(e.line),d=n(c,e.line,h,d);if("single"===d){var f=h.text.slice(0,e.ch).replace("`",""),p=h.text.slice(e.ch).replace("`","");c.replaceRange(f+p,{line:e.line,ch:0},{line:e.line,ch:99999999999999}),e.ch--,e!==u&&u.ch--,c.setSelection(e,u),c.focus()}else if("fenced"===d){if(e.line!==u.line||e.ch!==u.ch){for(i=e.line;0<=i&&!o(h=c.getLineHandle(i));i--);var m,g,v,f=l(c.getTokenAt({line:i,ch:1})).fencedChars,y=o(c.getLineHandle(e.line))?(m="",e.line):o(c.getLineHandle(e.line-1))?(m="",e.line-1):(m=f+"\n",e.line);o(c.getLineHandle(u.line))?(g="",v=u.line,0===u.ch&&(v+=1)):v=(g=0!==u.ch&&o(c.getLineHandle(u.line+1))?"":f+"\n",u.line+1),0===u.ch&&--v,c.operation(function(){c.replaceRange(g,{line:v,ch:0},{line:v+(g?0:1),ch:0}),c.replaceRange(m,{line:y,ch:0},{line:y+(m?0:1),ch:0})}),c.setSelection({line:y+(m?1:0),ch:0},{line:v+(m?1:-1),ch:0})}else{var p=e.line;if(o(c.getLineHandle(e.line))&&(p="fenced"===n(c,e.line+1)?(i=e.line,e.line+1):(r=e.line,e.line-1)),void 0===i)for(i=p;0<=i&&!o(h=c.getLineHandle(i));i--);if(void 0===r)for(a=c.lineCount(),r=p;r<a&&!o(h=c.getLineHandle(r));r++);c.operation(function(){c.replaceRange("",{line:i,ch:0},{line:i+1,ch:0}),c.replaceRange("",{line:r-1,ch:0},{line:r,ch:0})})}c.focus()}else if("indented"===d){if(e.line!==u.line||e.ch!==u.ch)i=e.line,r=u.line,0===u.ch&&r--;else{for(i=e.line;0<=i;i--)if(!(h=c.getLineHandle(i)).text.match(/^\s*$/)&&"indented"!==n(c,i,h)){i+=1;break}for(a=c.lineCount(),r=e.line;r<a;r++)if(!(h=c.getLineHandle(r)).text.match(/^\s*$/)&&"indented"!==n(c,r,h)){--r;break}}f=c.getLineHandle(r+1),p=f&&c.getTokenAt({line:r+1,ch:f.text.length-1});p&&l(p).indentedCode&&c.replaceRange("\n",{line:r+1,ch:0});for(var x=i;x<=r;x++)c.indentLine(x,"subtract");c.focus()}else{d=e.line===u.line&&e.ch===u.ch&&0===e.ch,f=e.line!==u.line;d||f?(p=c,d=u,f=t,t=(u=e).line+1,e=d.line+1,u=u.line!==d.line,s="\n"+f,u&&e++,u&&0===d.ch&&(s=f+"\n",e--),D(p,!1,[f+"\n",s]),p.setSelection({line:t,ch:0},{line:e,ch:0})):D(c,!1,["`","`"])}}function a(e){F(e.codemirror,"quote")}function s(e){A(e.codemirror,"smaller")}function p(e){A(e.codemirror,"bigger")}function m(e){A(e.codemirror,void 0,1)}function g(e){A(e.codemirror,void 0,2)}function v(e){A(e.codemirror,void 0,3)}function y(e){F(e.codemirror,"unordered-list")}function x(e){F(e.codemirror,"ordered-list")}function b(e){var t=e.codemirror;if(!/editor-preview-active/.test(t.getWrapperElement().lastChild.className))for(var n,e=t.getCursor("start"),i=t.getCursor("end"),r=e.line;r<=i.line;r++)n=(n=t.getLine(r)).replace(/^[ ]*([# ]+|\*|\-|[> ]+|[0-9]+(.|\)))[ ]*/,""),t.replaceRange(n,{line:r,ch:0},{line:r,ch:99999999999999})}function w(e){var t=e.codemirror,n=h(t),e=e.options,i="http://";if(e.promptURLs&&!(i=prompt(e.promptTexts.link)))return!1;D(t,n.link,e.insertTexts.link,i)}function C(e){var t=e.codemirror,n=h(t),e=e.options,i="http://";if(e.promptURLs&&!(i=prompt(e.promptTexts.image)))return!1;D(t,n.image,e.insertTexts.image,i)}function k(e){var t=e.codemirror,n=h(t),e=e.options;D(t,n.table,e.insertTexts.table)}function S(e){var t=e.codemirror,n=h(t),e=e.options;D(t,n.image,e.insertTexts.horizontalRule)}function L(e){e=e.codemirror;e.undo(),e.focus()}function T(e){e=e.codemirror;e.redo(),e.focus()}function M(e){var t=e.codemirror,n=t.getWrapperElement(),i=n.nextSibling,r=e.toolbarElements["side-by-side"],o=!1,r=(/editor-preview-active-side/.test(i.className)?(i.className=i.className.replace(/\s*editor-preview-active-side\s*/g,""),r.className=r.className.replace(/\s*active\s*/g,""),n.className=n.className.replace(/\s*CodeMirror-sided\s*/g," ")):(setTimeout(function(){t.getOption("fullScreen")||f(e),i.className+=" editor-preview-active-side"},1),r.className+=" active",n.className+=" CodeMirror-sided",o=!0),n.lastChild);/editor-preview-active/.test(r.className)&&(r.className=r.className.replace(/\s*editor-preview-active\s*/g,""),r=e.toolbarElements.preview,n=n.previousSibling,r.className=r.className.replace(/\s*active\s*/g,""),n.className=n.className.replace(/\s*disabled-for-preview*/g,""));t.sideBySideRenderingFunction||(t.sideBySideRenderingFunction=function(){i.innerHTML=e.options.previewRender(e.value(),i)}),o?(i.innerHTML=e.options.previewRender(e.value(),i),t.on("update",t.sideBySideRenderingFunction)):t.off("update",t.sideBySideRenderingFunction),t.refresh()}function N(e){var t=e.codemirror,n=t.getWrapperElement(),i=n.previousSibling,r=!!e.options.toolbar&&e.toolbarElements.preview,o=n.lastChild,n=(o&&/editor-preview/.test(o.className)||((o=document.createElement("div")).className="editor-preview",n.appendChild(o)),/editor-preview-active/.test(o.className)?(o.className=o.className.replace(/\s*editor-preview-active\s*/g,""),r&&(r.className=r.className.replace(/\s*active\s*/g,""),i.className=i.className.replace(/\s*disabled-for-preview*/g,""))):(setTimeout(function(){o.className+=" editor-preview-active"},1),r&&(r.className+=" active",i.className+=" disabled-for-preview")),o.innerHTML=e.options.previewRender(e.value(),o),t.getWrapperElement().nextSibling);/editor-preview-active-side/.test(n.className)&&M(e)}function D(e,t,n,i){var r,o,l,a;/editor-preview-active/.test(e.getWrapperElement().lastChild.className)||(o=n[0],n=n[1],l=e.getCursor("start"),a=e.getCursor("end"),i&&(n=n.replace("#url#",i)),t?(o=(r=e.getLine(l.line)).slice(0,l.ch),n=r.slice(l.ch),e.replaceRange(o+n,{line:l.line,ch:0})):(r=e.getSelection(),e.replaceSelection(o+r+n),l.ch+=o.length,l!==a&&(a.ch+=o.length)),e.setSelection(l,a),e.focus())}function A(e,t,n){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){for(var i,r,o,l=e.getCursor("start"),a=e.getCursor("end"),s=l.line;s<=a.line;s++)i=s,o=r=void 0,r=(o=e.getLine(i)).search(/[^#]/),o=void 0!==t?r<=0?"bigger"==t?"###### "+o:"# "+o:6==r&&"smaller"==t?o.substr(7):1==r&&"bigger"==t?o.substr(2):"bigger"==t?o.substr(1):"#"+o:1==n?r<=0?"# "+o:r==n?o.substr(r+1):"# "+o.substr(r+1):2==n?r<=0?"## "+o:r==n?o.substr(r+1):"## "+o.substr(r+1):r<=0?"### "+o:r==n?o.substr(r+1):"### "+o.substr(r+1),e.replaceRange(o,{line:i,ch:0},{line:i,ch:99999999999999});e.focus()}}function F(e,t){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){for(var n,i,r=h(e),o=e.getCursor("start"),l=e.getCursor("end"),a={quote:/^(\s*)\>\s+/,"unordered-list":/^(\s*)(\*|\-|\+)\s+/,"ordered-list":/^(\s*)\d+\.\s+/},s={quote:"> ","unordered-list":"* ","ordered-list":"1. "},c=o.line;c<=l.line;c++)n=c,i=void 0,i=e.getLine(n),i=r[t]?i.replace(a[t],"$1"):s[t]+i,e.replaceRange(i,{line:n,ch:0},{line:n,ch:99999999999999});e.focus()}}function E(e,t,n,i){var r,o,l,a,s;/editor-preview-active/.test(e.codemirror.getWrapperElement().lastChild.className)||(i=void 0===i?n:i,r=h(e=e.codemirror),l=n,i=i,a=e.getCursor("start"),s=e.getCursor("end"),r[t]?(l=(o=e.getLine(a.line)).slice(0,a.ch),i=o.slice(a.ch),"bold"==t?(l=l.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),i=i.replace(/(\*\*|__)/,"")):"italic"==t?(l=l.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),i=i.replace(/(\*|_)/,"")):"strikethrough"==t&&(l=l.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),i=i.replace(/(\*\*|~~)/,"")),e.replaceRange(l+i,{line:a.line,ch:0},{line:a.line,ch:99999999999999}),"bold"==t||"strikethrough"==t?(a.ch-=2,a!==s&&(s.ch-=2)):"italic"==t&&(--a.ch,a!==s)&&--s.ch):(o=e.getSelection(),"bold"==t?o=(o=o.split("**").join("")).split("__").join(""):"italic"==t?o=(o=o.split("*").join("")).split("_").join(""):"strikethrough"==t&&(o=o.split("~~").join("")),e.replaceSelection(l+o+i),a.ch+=n.length,s.ch=a.ch+o.length),e.setSelection(a,s),e.focus())}function O(e){for(var t=1;t<arguments.length;t++)e=function e(t,n){for(var i in n)n.hasOwnProperty(i)&&(n[i]instanceof Array?t[i]=n[i].concat(t[i]instanceof Array?t[i]:[]):null!==n[i]&&"object"==typeof n[i]&&n[i].constructor===Object?t[i]=e(t[i]||{},n[i]):t[i]=n[i]);return t}(e,arguments[t]);return e}function q(e){var t=e.match(/[a-zA-Z0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g),n=0;if(null!==t)for(var i=0;i<t.length;i++)19968<=t[i].charCodeAt(0)?n+=t[i].length:n+=1;return n}var H={bold:{name:"bold",action:t,className:"fa fa-bold",title:"Bold",default:!0},italic:{name:"italic",action:n,className:"fa fa-italic",title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:o,className:"fa fa-strikethrough",title:"Strikethrough"},heading:{name:"heading",action:s,className:"fa fa-header",title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:s,className:"fa fa-header fa-header-x fa-header-smaller",title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:p,className:"fa fa-header fa-header-x fa-header-bigger",title:"Bigger Heading"},"heading-1":{name:"heading-1",action:m,className:"fa fa-header fa-header-x fa-header-1",title:"Big Heading"},"heading-2":{name:"heading-2",action:g,className:"fa fa-header fa-header-x fa-header-2",title:"Medium Heading"},"heading-3":{name:"heading-3",action:v,className:"fa fa-header fa-header-x fa-header-3",title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:l,className:"fa fa-code",title:"Code"},quote:{name:"quote",action:a,className:"fa fa-quote-left",title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:y,className:"fa fa-list-ul",title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:x,className:"fa fa-list-ol",title:"Numbered List",default:!0},"clean-block":{name:"clean-block",action:b,className:"fa fa-eraser fa-clean-block",title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:w,className:"fa fa-link",title:"Create Link",default:!0},image:{name:"image",action:C,className:"fa fa-picture-o",title:"Insert Image",default:!0},table:{name:"table",action:k,className:"fa fa-table",title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:S,className:"fa fa-minus",title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:N,className:"fa fa-eye no-disable",title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:M,className:"fa fa-columns no-disable no-mobile",title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:f,className:"fa fa-arrows-alt no-disable no-mobile",title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://simplemde.com/markdown-guide",className:"fa fa-question-circle",title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:L,className:"fa fa-undo no-disable",title:"Undo"},redo:{name:"redo",action:T,className:"fa fa-repeat no-disable",title:"Redo"}},_={link:["[","](#url#)"],image:[""],table:["","\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],horizontalRule:["","\n\n-----\n\n"]},U={link:"URL for the link:",image:"URL of the image:"},G={bold:"**",code:"```",italic:"*"};function I(e){(e=e||{}).parent=this,console.log("finally it works again");var t,n=!0;if(!1===e.autoDownloadFontAwesome&&(n=!1),!0!==e.autoDownloadFontAwesome)for(var i=document.styleSheets,r=0;r<i.length;r++)i[r].href&&-1<i[r].href.indexOf("//maxcdn.bootstrapcdn.com/font-awesome/")&&(n=!1);if(n&&((t=document.createElement("link")).rel="stylesheet",t.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(t)),e.element)this.element=e.element;else if(null===e.element)return void console.log("SimpleMDE: Error. No element was found.");if(void 0===e.toolbar)for(var o in e.toolbar=[],H)H.hasOwnProperty(o)&&(-1!=o.indexOf("separator-")&&e.toolbar.push("|"),!0===H[o].default||e.showIcons&&e.showIcons.constructor===Array&&-1!=e.showIcons.indexOf(o))&&e.toolbar.push(o);e.hasOwnProperty("status")||(e.status=["autosave","lines","words","cursor"]),e.previewRender||(e.previewRender=function(e){return this.parent.markdown(e)}),e.parsingConfig=O({highlightFormatting:!0},e.parsingConfig||{}),e.insertTexts=O({},_,e.insertTexts||{}),e.promptTexts=U,e.blockStyles=O({},G,e.blockStyles||{}),e.shortcuts=O({},B,e.shortcuts||{}),null!=e.autosave&&null!=e.autosave.unique_id&&""!=e.autosave.unique_id&&(e.autosave.uniqueId=e.autosave.unique_id),this.options=e,this.render(),!e.initialValue||this.options.autosave&&!0===this.options.autosave.foundSavedValue||this.value(e.initialValue)}function V(){if("object"==typeof localStorage){try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch(e){return}return 1}}I.prototype.markdown=function(e){var t;if(marked)return t={},this.options&&this.options.renderingConfig&&!1===this.options.renderingConfig.singleLineBreaks?t.breaks=!1:t.breaks=!0,this.options&&this.options.renderingConfig&&!0===this.options.renderingConfig.codeSyntaxHighlighting&&window.hljs&&(t.highlight=function(e){return window.hljs.highlightAuto(e).value}),marked.setOptions(t),marked(e)},I.prototype.render=function(e){if(e=e||this.element||document.getElementsByTagName("textarea")[0],!this._rendered||this._rendered!==e){this.element=e;var t,n,i,r,o=this.options,l=this,a={};for(t in o.shortcuts)null!==o.shortcuts[t]&&null!==u[t]&&!function(e){a[d(o.shortcuts[e])]=function(){u[e](l)}}(t);a.Enter="newlineAndIndentContinueMarkdownList",a.Tab="tabAndIndentMarkdownList",a["Shift-Tab"]="shiftTabAndUnindentMarkdownList",a.Esc=function(e){e.getOption("fullScreen")&&f(l)},document.addEventListener("keydown",function(e){27==(e=e||window.event).keyCode&&l.codemirror.getOption("fullScreen")&&f(l)},!1),!1!==o.spellChecker?(n="spell-checker",(i=o.parsingConfig).name="gfm",i.gitHubSpice=!1,R({codeMirrorInstance:c})):((n=o.parsingConfig).name="gfm",n.gitHubSpice=!1),this.codemirror=c.fromTextArea(e,{mode:n,backdrop:i,theme:"paper",tabSize:null!=o.tabSize?o.tabSize:2,indentUnit:null!=o.tabSize?o.tabSize:2,indentWithTabs:!1!==o.indentWithTabs,lineNumbers:!1,autofocus:!0===o.autofocus,extraKeys:a,lineWrapping:!1!==o.lineWrapping,allowDropFileTypes:["text/plain"],placeholder:o.placeholder||e.getAttribute("placeholder")||"",styleSelectedText:null==o.styleSelectedText||o.styleSelectedText}),!0===o.forceSync&&(r=this.codemirror).on("change",function(){r.save()}),!(this.gui={})!==o.toolbar&&(this.gui.toolbar=this.createToolbar()),!1!==o.status&&(this.gui.statusbar=this.createStatusbar()),null!=o.autosave&&!0===o.autosave.enabled&&this.autosave(),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element;var s=this.codemirror;setTimeout(function(){s.refresh()}.bind(s),0)}},I.prototype.autosave=function(){var e,t,n,i,r,o;V()?null==(e=this).options.autosave.uniqueId||""==this.options.autosave.uniqueId?console.log("SimpleMDE: You must set a uniqueId to use the autosave feature"):(null!=e.element.form&&null!=e.element.form&&e.element.form.addEventListener("submit",function(){localStorage.removeItem("smde_"+e.options.autosave.uniqueId)}),!0!==this.options.autosave.loaded&&("string"==typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&""!=localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0),localStorage.setItem("smde_"+this.options.autosave.uniqueId,e.value()),null!=(t=document.getElementById("autosaved"))&&""!=t&&(n=(i=new Date).getHours(),i=i.getMinutes(),r="am",12<=(o=n)&&(o=n-12,r="pm"),t.innerHTML="Autosaved: "+(o=0==o?12:o)+":"+(i=i<10?"0"+i:i)+" "+r),this.autosaveTimeoutId=setTimeout(function(){e.autosave()},this.options.autosave.delay||1e4)):console.log("SimpleMDE: localStorage not available, cannot autosave")},I.prototype.clearAutosavedValue=function(){V()?null==this.options.autosave||null==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId?console.log("SimpleMDE: You must set a uniqueId to clear the autosave value"):localStorage.removeItem("smde_"+this.options.autosave.uniqueId):console.log("SimpleMDE: localStorage not available, cannot autosave")},I.prototype.createSideBySide=function(){var t=this.codemirror,e=t.getWrapperElement(),n=e.nextSibling,i=(n&&/editor-preview-side/.test(n.className)||((n=document.createElement("div")).className="editor-preview-side",e.parentNode.insertBefore(n,e.nextSibling)),!1),r=!1;return t.on("scroll",function(e){var t;i?i=!1:(r=!0,t=e.getScrollInfo().height-e.getScrollInfo().clientHeight,e=parseFloat(e.getScrollInfo().top)/t,t=(n.scrollHeight-n.clientHeight)*e,n.scrollTop=t)}),n.onscroll=function(){var e;r?r=!1:(i=!0,e=n.scrollHeight-n.clientHeight,e=parseFloat(n.scrollTop)/e,e=(t.getScrollInfo().height-t.getScrollInfo().clientHeight)*e,t.scrollTo(0,e))},n},I.prototype.createToolbar=function(e){if((e=e||this.options.toolbar)&&0!==e.length){for(var t=0;t<e.length;t++)null!=H[e[t]]&&(e[t]=H[e[t]]);var n,i,r=document.createElement("div"),o=(r.className="editor-toolbar",this),l={};for(o.toolbar=e,t=0;t<e.length;t++)if(("guide"!=e[t].name||!1!==o.options.toolbarGuideIcon)&&!(o.options.hideIcons&&-1!=o.options.hideIcons.indexOf(e[t].name)||("fullscreen"==e[t].name||"side-by-side"==e[t].name)&&(n=void 0,i=!1,n=navigator.userAgent||navigator.vendor||window.opera,i=!(!/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(n)&&!/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(n.substr(0,4)))||i))){if("|"===e[t]){for(var a=!1,s=t+1;s<e.length;s++)"|"===e[s]||o.options.hideIcons&&-1!=o.options.hideIcons.indexOf(e[s].name)||(a=!0);if(!a)continue}!function(t){var e="|"===t?((e=document.createElement("i")).className="separator",e.innerHTML="|",e):j(t,o.options.toolbarTips,o.options.shortcuts);t.action&&("function"==typeof t.action?e.onclick=function(e){e.preventDefault(),t.action(o)}:"string"==typeof t.action&&(e.href=t.action,e.target="_blank")),l[t.name||t]=e,r.appendChild(e)}(e[t])}o.toolbarElements=l;var c=this.codemirror,u=(c.on("cursorActivity",function(){var e,t,n,i=h(c);for(e in l)n=void 0,n=l[t=e],i[t]?n.className+=" active":"fullscreen"!=t&&"side-by-side"!=t&&(n.className=n.className.replace(/\s*active\s*/g,""))}),c.getWrapperElement());return u.parentNode.insertBefore(r,u),r}},I.prototype.createStatusbar=function(e){e=e||this.options.status;var t=this.options,n=this.codemirror;if(e&&0!==e.length){for(var i=[],r=0;r<e.length;r++){var o,l=void 0,a=void 0;"object"==typeof e[r]?i.push({className:e[r].className,defaultValue:e[r].defaultValue,onUpdate:e[r].onUpdate}):("words"===(o=e[r])?(a=function(e){e.innerHTML=q(n.getValue())},l=function(e){e.innerHTML=q(n.getValue())}):"lines"===o?(a=function(e){e.innerHTML=n.lineCount()},l=function(e){e.innerHTML=n.lineCount()}):"cursor"===o?(a=function(e){e.innerHTML="0:0"},l=function(e){var t=n.getCursor();e.innerHTML=t.line+":"+t.ch}):"autosave"===o&&(a=function(e){null!=t.autosave&&!0===t.autosave.enabled&&e.setAttribute("id","autosaved")}),i.push({className:o,defaultValue:a,onUpdate:l}))}var s=document.createElement("div");for(s.className="editor-statusbar",r=0;r<i.length;r++){var c=i[r],u=document.createElement("span");u.className=c.className,"function"==typeof c.defaultValue&&c.defaultValue(u),"function"==typeof c.onUpdate&&this.codemirror.on("update",function(e,t){return function(){t.onUpdate(e)}}(u,c)),s.appendChild(u)}var d=this.codemirror.getWrapperElement();return d.parentNode.insertBefore(s,d.nextSibling),s}},I.prototype.value=function(e){return void 0===e?this.codemirror.getValue():(this.codemirror.getDoc().setValue(e),this)},I.toggleBold=t,I.toggleItalic=n,I.toggleStrikethrough=o,I.toggleBlockquote=a,I.toggleHeadingSmaller=s,I.toggleHeadingBigger=p,I.toggleHeading1=m,I.toggleHeading2=g,I.toggleHeading3=v,I.toggleCodeBlock=l,I.toggleUnorderedList=y,I.toggleOrderedList=x,I.cleanBlock=b,I.drawLink=w,I.drawImage=C,I.drawTable=k,I.drawHorizontalRule=S,I.undo=L,I.redo=T,I.togglePreview=N,I.toggleSideBySide=M,I.toggleFullScreen=f,I.prototype.toggleBold=function(){t(this)},I.prototype.toggleItalic=function(){n(this)},I.prototype.toggleStrikethrough=function(){o(this)},I.prototype.toggleBlockquote=function(){a(this)},I.prototype.toggleHeadingSmaller=function(){s(this)},I.prototype.toggleHeadingBigger=function(){p(this)},I.prototype.toggleHeading1=function(){m(this)},I.prototype.toggleHeading2=function(){g(this)},I.prototype.toggleHeading3=function(){v(this)},I.prototype.toggleCodeBlock=function(){l(this)},I.prototype.toggleUnorderedList=function(){y(this)},I.prototype.toggleOrderedList=function(){x(this)},I.prototype.cleanBlock=function(){b(this)},I.prototype.drawLink=function(){w(this)},I.prototype.drawImage=function(){C(this)},I.prototype.drawTable=function(){k(this)},I.prototype.drawHorizontalRule=function(){S(this)},I.prototype.undo=function(){L(this)},I.prototype.redo=function(){T(this)},I.prototype.togglePreview=function(){N(this)},I.prototype.toggleSideBySide=function(){M(this)},I.prototype.toggleFullScreen=function(){f(this)},I.prototype.isPreviewActive=function(){var e=this.codemirror.getWrapperElement().lastChild;return/editor-preview-active/.test(e.className)},I.prototype.isSideBySideActive=function(){var e=this.codemirror.getWrapperElement().nextSibling;return/editor-preview-active-side/.test(e.className)},I.prototype.isFullscreenActive=function(){return this.codemirror.getOption("fullScreen")},I.prototype.getState=function(){return h(this.codemirror)},I.prototype.toTextArea=function(){var e=this.codemirror,t=e.getWrapperElement();t.parentNode&&(this.gui.toolbar&&t.parentNode.removeChild(this.gui.toolbar),this.gui.statusbar&&t.parentNode.removeChild(this.gui.statusbar),this.gui.sideBySide)&&t.parentNode.removeChild(this.gui.sideBySide),e.toTextArea(),this.autosaveTimeoutId&&(clearTimeout(this.autosaveTimeoutId),this.autosaveTimeoutId=void 0,this.clearAutosavedValue())},W.exports=I},{"./codemirror/tablist":14,codemirror:8,"codemirror-spell-checker":2,"codemirror/addon/display/fullscreen.js":3,"codemirror/addon/display/placeholder.js":4,"codemirror/addon/edit/continuelist.js":5,"codemirror/addon/mode/overlay.js":6,"codemirror/addon/selection/mark-selection.js":7,"codemirror/mode/gfm/gfm.js":9,"codemirror/mode/markdown/markdown.js":10,"codemirror/mode/xml/xml.js":12}]},{},[15])(15)}); |