HTML Editor Syntax Highlighter - Version 1.6.9

Version Description

  • Fixed issues with switching editor modes in WP 4.3
Download this release

Release Info

Developer nixdns
Plugin Icon 128x128 HTML Editor Syntax Highlighter
Version 1.6.9
Comparing to
See all releases

Code changes from version 1.6.8 to 1.6.9

html-editor-syntax-highlighter.php CHANGED
@@ -3,12 +3,13 @@
3
  * Plugin Name: HTML Editor Syntax Highlighter
4
  * Plugin URI: http://wordpress.org/extend/plugins/html-editor-syntax-highlighter/
5
  * Description: Syntax Highlighting in WordPress HTML Editor
 
6
  * Author: Petr Mukhortov
7
  * Author URI: http://mukhortov.com/
8
- * Version: 1.6.8
9
  * Requires at least: 3.3
10
- * Tested up to: 4.3
11
- * Stable tag: 1.6.8
12
  **/
13
 
14
  if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
  * Plugin Name: HTML Editor Syntax Highlighter
4
  * Plugin URI: http://wordpress.org/extend/plugins/html-editor-syntax-highlighter/
5
  * Description: Syntax Highlighting in WordPress HTML Editor
6
+ * Text Domain: html-editor-syntax-highlighter
7
  * Author: Petr Mukhortov
8
  * Author URI: http://mukhortov.com/
9
+ * Version: 1.6.9
10
  * Requires at least: 3.3
11
+ * Tested up to: 4.3.1
12
+ * Stable tag: 1.6.9
13
  **/
14
 
15
  if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
lib/hesh.min.js CHANGED
@@ -1,6 +1,6 @@
1
- function heshPlugin(){var e=null,t=0,r=0,n=document.getElementById("content"),i=null!==document.getElementById("post_ID")?document.getElementById("post_ID").value:0,o=document.getElementById("content-html"),a=document.getElementById("content-tmce"),l=-1!==document.cookie.indexOf("hesh_plugin_theme=mbo")?"mbo":"default",s=-1!==document.cookie.indexOf("editor%3Dtinymce")?!0:!1,u=null!==document.getElementById("content-tmce")?!0:!1,c=document.getElementById("ed_toolbar"),d=document.getElementById("wp-content-editor-container"),f="heshFullscreen",h=document.getElementById("publish"),p={mode:"text/html",tabMode:"indent",theme:l,lineNumbers:!0,matchBrackets:!0,indentUnit:4,indentWithTabs:!0,enterMode:"keep",lineWrapping:!0,autofocus:!0,styleActiveLine:!0,electricChars:!1,extraKeys:{F11:function(){A()},Esc:function(){A()},"Ctrl-S":function(){h.click()},"Cmd-S":function(){h.click()}}},m=function(e){var t="; "+document.cookie,r=t.split("; "+e+"=");return 2==r.length?r.pop().split(";").shift():void 0},g=m("hesh_plugin_font_size")||"12",v=function(r){C(),e=CodeMirror.fromTextArea(r,p),e.on("change",function(){e.save(),clearTimeout(x),x=setTimeout(k,3e3)}),e.on("cursorActivity",function(){var t=e.getCursor();document.cookie="hesh_plugin_pos="+i+","+t.line+","+t.ch});var n=(m("hesh_plugin_pos")||"0,0,0").split(",");i===n[0]&&e.setCursor(parseFloat(n[1]),parseFloat(n[2])),T(),E(),t=1,y(),window.addEventListener("resize",w),window.setTimeout(k,3e3)},y=function(){document.querySelector(".CodeMirror").style.marginTop=c.clientHeight+"px"},b,w=function(){clearTimeout(b),b=setTimeout(y,250)},x,k=function(){document.querySelector("textarea.wp-editor-area").style.height=document.querySelector(".CodeMirror").clientHeight+"px"},C=function(){if(!r){var e={more:["<!--more-->",""],comment:["<!-- "," -->"],code:["<code>","</code>"],li:["<li>","</li>"],ol:["<ol>","</ol>"],ul:["<ul>","</ul>"],img:['<img src="$" alt="','">',"Enter the URL of the image"],ins:["<ins>","</ins>"],del:["<del>","</del>"],link:['<a href="$">',"</a>","Enter the destination URL"],blockquote:["\r<blockquote>","</blockquote>\r"],h3:["<h3>","</h3>"],h2:["<h2>","</h2>"],h1:["<h1>","</h1>"],p:["<p>","</p>"],i:["<em>","</em>"],b:["<strong>","</strong>"]};for(var t in e){var n=e[t],i=n[2]?'data-prompt="'+n[2]+'"':"";c.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_content_'+t+"\" data-start='"+n[0]+"' data-end='"+n[1]+"' "+i+' class="ed_button button cm_ed_button" value="'+t+'">'),document.getElementById("cm_content_"+t).onclick=L}H(),z(),N(),r=1}},L=function(){var t=e.getCursor("start"),r=this.getAttribute("data-start"),n=this.getAttribute("data-end"),i=this.getAttribute("data-prompt")||null,o=e.getSelection();"cm_content_link"===this.id&&wpLink?(wpLink.open(),document.getElementById("wp-link-submit").onclick=function(){var n=wpLink.getAttrs();r='<a href="'+n.href+'" title="'+n.title+'" target="'+n.target+'">',e.replaceSelection(r+o+"</a>"),wpLink.close(),e.setCursor(t.line,t.ch+r.length),e.focus()}):(i&&(r=r.replace("$",prompt(i,""))),e.replaceSelection(r+o+n),e.setCursor(t.line,t.ch+r.length),e.focus())},S=function(){t&&(switchEditors.switchto&&switchEditors.switchto(this),e.toTextArea(),o.onclick=M,t=0,window.removeEventListener("resize",w))},M=function(){t||(switchEditors.switchto&&switchEditors.switchto(this),v(n),a.onclick=S)},T=function(){var e=document.querySelector(".CodeMirror"),t=document.createElement("div"),r=document.getElementById("wp-content-wrap"),n=e.getBoundingClientRect().top,i=function(t){t=t||window.event;var r=(t.pageY||t.clientY+document.body.scrollTop+document.documentElement.scrollTop)-n;e.style.height=(r>10?r:10)+"px",window.getSelection().removeAllRanges()};t.className="content-resize-handle",r.appendChild(t),t.onmousedown=function(){document.onmousemove=i},document.onmouseup=function(){document.onmousemove=null}},A=function(){d.className=-1===d.className.indexOf(f)?d.className+" "+f:d.className.replace(f,"");var t=document.getElementById("cm_content_fullscreen");t.value="fullscreen"===t.value?"exit fullscreen":"fullscreen",e.focus()},N=function(){c.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_content_fullscreen" class="ed_button button" title="Toggle fullscreen mode" value="fullscreen">'),document.getElementById("cm_content_fullscreen").onclick=A},H=function(){var t=function(){return"mbo"===l?"light":"dark"};c.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_select_theme" class="ed_button button" title="Change editor colour scheme" value="'+t()+'">'),document.getElementById("cm_select_theme").onclick=function(){l="mbo"===l?"default":"mbo",e.setOption("theme",l),document.cookie="hesh_plugin_theme="+l,this.value=t()}},O=function(){var e=document.getElementById("hesh-style"),t=".CodeMirror {font-size: "+g+"px !important;}";e?e.innerHTML=t:document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend",'<style id="hesh-style">'+t+"</style>")},z=function(){c.insertAdjacentHTML("afterbegin",'<select id="cm_font_size" class="button"><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="16">16</option><option value="18">18</option><option value="20">20</option><option value="22">22</option></select>');var t=document.getElementById("cm_font_size");O(),t.value=g,t.onchange=function(){g=this.value,O(),e.toTextArea(),v(n),e.focus(),document.cookie="hesh_plugin_font_size="+g}},E=function(){window.send_to_editor_wp||(window.send_to_editor_wp=send_to_editor,send_to_editor=function(r){t&&"content"===wpActiveEditor?(e.replaceSelection(r),e.save()):window.send_to_editor_wp(r)})};s&&u?o.onclick=M:(v(n),u?a.onclick=S:document.body.className+=" visual-editor-is-disabled")}!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);this.CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n||{},ii(vo,n,!1),p(n);var i=n.value;"string"==typeof i&&(i=new Ro(i,n.mode)),this.doc=i;var o=this.display=new t(r,i);o.wrapper.CodeMirror=this,c(this),s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!$i&&pt(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Zn},Ei&&setTimeout(oi(ht,this,!0),20),vt(this);var a=this;Ze(this,function(){a.curOp.forceUpdate=!0,yn(a,i),n.autofocus&&!$i||fi()==o.input?setTimeout(oi(Ft,a),20):Bt(a);for(var e in yo)yo.hasOwnProperty(e)&&yo[e](a,n[e],bo);for(var t=0;t<Co.length;++t)Co[t](a)})}function t(e,t){var r=this,n=r.input=si("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");Fi?n.style.width="1000px":n.setAttribute("wrap","off"),Ki&&(n.style.border="1px solid black"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck","false"),r.inputDiv=si("div",[n],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),r.scrollbarH=si("div",[si("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),r.scrollbarV=si("div",[si("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r.scrollbarFiller=si("div",null,"CodeMirror-scrollbar-filler"),r.gutterFiller=si("div",null,"CodeMirror-gutter-filler"),r.lineDiv=si("div",null,"CodeMirror-code"),r.selectionDiv=si("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=si("div",null,"CodeMirror-cursors"),r.measure=si("div",null,"CodeMirror-measure"),r.lineMeasure=si("div",null,"CodeMirror-measure"),r.lineSpace=si("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none"),r.mover=si("div",[si("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=si("div",[r.mover],"CodeMirror-sizer"),r.heightForcer=si("div",null,null,"position: absolute; height: "+Qo+"px; width: 1px;"),r.gutters=si("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=si("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=si("div",[r.inputDiv,r.scrollbarH,r.scrollbarV,r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),Wi&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),Ki&&(n.style.width="0px"),Fi||(r.scroller.draggable=!0),Gi&&(r.inputDiv.style.height="1px",r.inputDiv.style.position="absolute"),Wi&&(r.scrollbarH.style.minHeight=r.scrollbarV.style.minWidth="18px"),e.appendChild?e.appendChild(r.wrapper):e(r.wrapper),r.viewFrom=r.viewTo=t.first,r.view=[],r.externalMeasured=null,r.viewOffset=0,r.lastSizeC=0,r.updateLineNumbers=null,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.prevInput="",r.alignWidgets=!1,r.pollingFast=!1,r.poll=new Zn,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.inaccurateSelection=!1,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,be(e,100),e.state.modeGen++,e.curOp&&nt(e)}function i(e){e.options.lineWrapping?(mi(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth=""):(pi(e.display.wrapper,"CodeMirror-wrap"),h(e)),a(e),nt(e),De(e),setTimeout(function(){g(e)},100)}function o(e){var t=Ke(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/$e(e.display)-3);return function(i){if(Gr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function a(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&kn(e,t)})}function l(e){var t=Ao[e.options.keyMap],r=t.style;e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(r?" cm-keymap-"+r:"")}function s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),De(e)}function u(e){c(e),nt(e),setTimeout(function(){y(e)},20)}function c(e){var t=e.display.gutters,r=e.options.gutters;ui(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(si("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",d(e)}function d(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px",e.display.scrollbarH.style.left=e.options.fixedGutter?t+"px":0}function f(e){if(0==e.height)return 0;for(var t=e.text.length,r,n=e;r=Pr(n);){var i=r.find(0,!0);n=i.from.line,t+=i.from.ch-i.to.ch}for(n=e;r=_r(n);){var i=r.find(0,!0);t-=n.text.length-i.from.ch,n=i.to.line,t+=n.text.length-i.to.ch}return t}function h(e){var t=e.display,r=e.doc;t.maxLine=bn(r,r.first),t.maxLineLength=f(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=f(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function p(e){var t=ti(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function m(e){var t=e.display.scroller;return{clientHeight:t.clientHeight,barHeight:e.display.scrollbarV.clientHeight,scrollWidth:t.scrollWidth,clientWidth:t.clientWidth,barWidth:e.display.scrollbarH.clientWidth,docHeight:Math.round(e.doc.height+Le(e.display))}}function g(e,t){t||(t=m(e));var r=e.display,n=t.docHeight+Qo,i=t.scrollWidth>t.clientWidth,o=n>t.clientHeight;if(o?(r.scrollbarV.style.display="block",r.scrollbarV.style.bottom=i?vi(r.measure)+"px":"0",r.scrollbarV.firstChild.style.height=Math.max(0,n-t.clientHeight+(t.barHeight||r.scrollbarV.clientHeight))+"px"):(r.scrollbarV.style.display="",r.scrollbarV.firstChild.style.height="0"),i?(r.scrollbarH.style.display="block",r.scrollbarH.style.right=o?vi(r.measure)+"px":"0",r.scrollbarH.firstChild.style.width=t.scrollWidth-t.clientWidth+(t.barWidth||r.scrollbarH.clientWidth)+"px"):(r.scrollbarH.style.display="",r.scrollbarH.firstChild.style.width="0"),i&&o?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=r.scrollbarFiller.style.width=vi(r.measure)+"px"):r.scrollbarFiller.style.display="",i&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=vi(r.measure)+"px",r.gutterFiller.style.width=r.gutters.offsetWidth+"px"):r.gutterFiller.style.display="",!e.state.checkedOverlayScrollbar&&t.clientHeight>0){if(0===vi(r.measure)){var a=Yi&&!qi?"12px":"18px";r.scrollbarV.style.minWidth=r.scrollbarH.style.minHeight=a;var l=function(t){Vn(t)!=r.scrollbarV&&Vn(t)!=r.scrollbarH&&Qe(e,wt)(t)};Ko(r.scrollbarV,"mousedown",l),Ko(r.scrollbarH,"mousedown",l)}e.state.checkedOverlayScrollbar=!0}}function v(e,t,r){var n=r&&null!=r.top?r.top:e.scroller.scrollTop;n=Math.floor(n-Ce(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=Ln(t,n),a=Ln(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;if(o>l)return{from:l,to:Ln(t,Sn(bn(t,l))+e.wrapper.clientHeight)};if(Math.min(s,t.lastLine())>=a)return{from:Ln(t,Sn(bn(t,s))-e.wrapper.clientHeight),to:s}}return{from:o,to:a}}function y(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=x(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&r[a].gutter&&(r[a].gutter.style.left=o);var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function b(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=w(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(si("div",[si("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a),n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",d(e),!0}return!1}function w(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function x(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function k(e,t,r){for(var n=e.display.viewFrom,i=e.display.viewTo,o,a=v(e.display,e.doc,t),l=!0;;l=!1){var s=e.display.scroller.clientWidth;if(!C(e,a,r))break;o=!0,e.display.maxLineChanged&&!e.options.lineWrapping&&L(e);var u=m(e);if(me(e),S(e,u),g(e,u),Fi&&e.options.lineWrapping&&M(e,u),l&&e.options.lineWrapping&&s!=e.display.scroller.clientWidth)r=!0;else if(r=!1,t&&null!=t.top&&(t={top:Math.min(u.docHeight-Qo-u.clientHeight,t.top)}),a=v(e.display,e.doc,t),a.from>=e.display.viewFrom&&a.to<=e.display.viewTo)break}return e.display.updateLineNumbers=null,o&&(qn(e,"update",e),(e.display.viewFrom!=n||e.display.viewTo!=i)&&qn(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo)),o}function C(e,t,r){var n=e.display,i=e.doc;if(!n.wrapper.offsetWidth)return void ot(e);if(!(!r&&t.from>=n.viewFrom&&t.to<=n.viewTo&&0==ut(e))){b(e)&&ot(e);var o=N(e),a=i.first+i.size,l=Math.max(t.from-e.options.viewportMargin,i.first),s=Math.min(a,t.to+e.options.viewportMargin);n.viewFrom<l&&l-n.viewFrom<20&&(l=Math.max(i.first,n.viewFrom)),n.viewTo>s&&n.viewTo-s<20&&(s=Math.min(a,n.viewTo)),to&&(l=jr(e.doc,l),s=Vr(e.doc,s));var u=l!=n.viewFrom||s!=n.viewTo||n.lastSizeC!=n.wrapper.clientHeight;st(e,l,s),n.viewOffset=Sn(bn(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var c=ut(e);if(u||0!=c||r){var d=fi();return c>4&&(n.lineDiv.style.display="none"),H(e,n.updateLineNumbers,o),c>4&&(n.lineDiv.style.display=""),d&&fi()!=d&&d.offsetHeight&&d.focus(),ui(n.cursorDiv),ui(n.selectionDiv),u&&(n.lastSizeC=n.wrapper.clientHeight,be(e,400)),T(e),!0}}}function L(e){var t=e.display,r=Ne(e,t.maxLine,t.maxLine.text.length).left;t.maxLineChanged=!1;var n=Math.max(0,r+3),i=Math.max(0,t.sizer.offsetLeft+n+Qo-t.scroller.clientWidth);t.sizer.style.minWidth=n+"px",i<e.doc.scrollLeft&&Nt(e,Math.min(t.scroller.scrollLeft,i),!0)}function S(e,t){e.display.sizer.style.minHeight=e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=Math.max(t.docHeight,t.clientHeight-Qo)+"px"}function M(e,t){e.display.sizer.offsetWidth+e.display.gutters.offsetWidth<e.display.scroller.clientWidth-1&&(e.display.sizer.style.minHeight=e.display.heightForcer.style.top="0px",e.display.gutters.style.height=t.docHeight+"px")}function T(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o;if(!i.hidden){if(Wi){var a=i.node.offsetTop+i.node.offsetHeight;o=a-r,r=a}else{var l=i.node.getBoundingClientRect();o=l.bottom-l.top}var s=i.line.height-o;if(2>o&&(o=Ke(t)),(s>.001||-.001>s)&&(kn(i.line,o),A(i.line),i.rest))for(var u=0;u<i.rest.length;u++)A(i.rest[u])}}}function A(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function N(e){for(var t=e.display,r={},n={},i=t.gutters.firstChild,o=0;i;i=i.nextSibling,++o)r[e.options.gutters[o]]=i.offsetLeft,n[e.options.gutters[o]]=i.offsetWidth;return{fixedPos:x(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function H(e,t,r){function n(t){var r=t.nextSibling;return Fi&&Yi&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var i=e.display,o=e.options.lineNumbers,a=i.lineDiv,l=a.firstChild,s=i.view,u=i.viewFrom,c=0;c<s.length;c++){var d=s[c];if(d.hidden);else if(d.node){for(;l!=d.node;)l=n(l);var f=o&&null!=t&&u>=t&&d.lineNumber;d.changes&&(ti(d.changes,"gutter")>-1&&(f=!1),O(e,d,u,r)),f&&(ui(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(w(e.options,u)))),l=d.node.nextSibling}else{var h=F(e,d,u,r);a.insertBefore(h,l)}u+=d.size}for(;l;)l=n(l)}function O(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?I(e,t):"gutter"==o?P(e,t,r,n):"class"==o?D(t):"widget"==o&&_(t,n)}t.changes=null}function z(e){return e.node==e.text&&(e.node=si("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),Wi&&(e.node.style.zIndex=2)),e.node}function E(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=z(e);e.background=r.insertBefore(si("div",null,t),r.firstChild)}}function W(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):an(e,t)}function I(e,t){var r=t.text.className,n=W(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,D(t)):r&&(t.text.className=r)}function D(e){E(e),e.line.wrapClass?z(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function P(e,t,r,n){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=z(t),a=t.gutter=o.insertBefore(si("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px"),t.text);if(!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(si("div",w(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var l=0;l<e.options.gutters.length;++l){var s=e.options.gutters[l],u=i.hasOwnProperty(s)&&i[s];u&&a.appendChild(si("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[s]+"px; width: "+n.gutterWidth[s]+"px"))}}}function _(e,t){e.alignable&&(e.alignable=null);for(var r=e.node.firstChild,n;r;r=n){var n=r.nextSibling;"CodeMirror-linewidget"==r.className&&e.node.removeChild(r)}B(e,t)}function F(e,t,r,n){var i=W(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),D(t),P(e,t,r,n),B(t,n),t.node}function B(e,t){if(R(e.line,e,t,!0),e.rest)for(var r=0;r<e.rest.length;r++)R(e.rest[r],e,t,!1)}function R(e,t,r,n){if(e.widgets)for(var i=z(t),o=0,a=e.widgets;o<a.length;++o){var l=a[o],s=si("div",[l.node],"CodeMirror-linewidget");l.handleMouseEvents||(s.ignoreEvents=!0),j(l,s,t,r),n&&l.above?i.insertBefore(s,t.gutter||t.text):i.appendChild(s),qn(l,"redraw")}}function j(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function V(e){return ro(e.line,e.ch)}function G(e,t){return no(e,t)<0?t:e}function q(e,t){return no(e,t)<0?e:t}function U(e,t){this.ranges=e,this.primIndex=t}function K(e,t){this.anchor=e,this.head=t}function Y(e,t){var r=e[t];e.sort(function(e,t){return no(e.from(),t.from())}),t=ti(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(no(o.to(),i.from())>=0){var a=q(o.from(),i.from()),l=G(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;t>=n&&--t,e.splice(--n,2,new K(s?l:a,s?a:l))}}return new U(e,t)}function X(e,t){return new U([new K(e,t||e)],0)}function Z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Q(e,t){if(t.line<e.first)return ro(e.first,0);var r=e.first+e.size-1;return t.line>r?ro(r,bn(e,r).text.length):J(t,bn(e,t.line).text.length)}function J(e,t){var r=e.ch;return null==r||r>t?ro(e.line,t):0>r?ro(e.line,0):e}function ee(e,t){return t>=e.first&&t<e.first+e.size}function te(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=Q(e,t[n]);return r}function re(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=no(r,i)<0;o!=no(n,i)<0?(i=r,r=n):o!=no(r,n)<0&&(r=n)}return new K(i,r)}return new K(n||r,r)}function ne(e,t,r,n){ue(e,new U([re(e,e.sel.primary(),t,r)],0),n)}function ie(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=re(e,e.sel.ranges[i],t[i],null);var o=Y(n,e.sel.primIndex);ue(e,o,r)}function oe(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,ue(e,Y(i,e.sel.primIndex),n)}function ae(e,t,r,n){ue(e,X(t,r),n)}function le(e,t){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new K(Q(e,t[r].anchor),Q(e,t[r].head))}};return Yo(e,"beforeSelectionChange",e,r),e.cm&&Yo(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Y(r.ranges,r.ranges.length-1):t}function se(e,t,r){var n=e.history.done,i=ei(n);i&&i.ranges?(n[n.length-1]=t,ce(e,t,r)):ue(e,t,r)}function ue(e,t,r){ce(e,t,r),En(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function ce(e,t,r){(Yn(e,"beforeSelectionChange")||e.cm&&Yn(e.cm,"beforeSelectionChange"))&&(t=le(e,t));var n=no(t.primary().head,e.sel.primary().head)<0?-1:1;de(e,he(e,t,n,!0)),r&&r.scroll===!1||!e.cm||ar(e.cm)}function de(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,$n(e.cm)),qn(e,"cursorActivity",e))}function fe(e){de(e,he(e,e.sel,null,!1),ea)}function he(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=pe(e,a.anchor,r,n),s=pe(e,a.head,r,n);(i||l!=a.anchor||s!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new K(l,s))}return i?Y(i,t.primIndex):t}function pe(e,t,r,n){var i=!1,o=t,a=r||1;e.cantEdit=!1;e:for(;;){var l=bn(e,o.line);if(l.markedSpans)for(var s=0;s<l.markedSpans.length;++s){var u=l.markedSpans[s],c=u.marker;if((null==u.from||(c.inclusiveLeft?u.from<=o.ch:u.from<o.ch))&&(null==u.to||(c.inclusiveRight?u.to>=o.ch:u.to>o.ch))){if(n&&(Yo(c,"beforeCursorEnter"),c.explicitlyCleared)){if(l.markedSpans){--s;continue}break}if(!c.atomic)continue;var d=c.find(0>a?-1:1);if(0==no(d,o)&&(d.ch+=a,d.ch<0?d=d.line>e.first?Q(e,ro(d.line-1)):null:d.ch>l.text.length&&(d=d.line<e.first+e.size-1?ro(d.line+1,0):null),!d)){if(i)return n?(e.cantEdit=!0,ro(e.first,0)):pe(e,t,r,!0);i=!0,d=t,a=-a}o=d;continue e}}return o}}function me(e){for(var t=e.display,r=e.doc,n=document.createDocumentFragment(),i=document.createDocumentFragment(),o=0;o<r.sel.ranges.length;o++){var a=r.sel.ranges[o],l=a.empty();(l||e.options.showCursorWhenSelecting)&&ge(e,a,n),l||ve(e,a,i)}if(e.options.moveInputWithCursor){var s=je(e,r.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),c=t.lineDiv.getBoundingClientRect(),d=Math.max(0,Math.min(t.wrapper.clientHeight-10,s.top+c.top-u.top)),f=Math.max(0,Math.min(t.wrapper.clientWidth-10,s.left+c.left-u.left));t.inputDiv.style.top=d+"px",t.inputDiv.style.left=f+"px"}ci(t.cursorDiv,n),ci(t.selectionDiv,i)}function ge(e,t,r){var n=je(e,t.head,"div"),i=r.appendChild(si("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(si("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function ve(e,t,r){function n(e,t,r,n){0>t&&(t=0),t=Math.round(t),n=Math.round(n),l.appendChild(si("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?c-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return Re(e,ro(t,r),"div",l,n)}var l=bn(a,t),s=l.text.length,d,f;return wi(Mn(l),r||0,null==i?s:i,function(e,t,a){var l=o(e,"left"),h,p,m;if(e==t)h=l,p=m=l.left;else{if(h=o(t-1,"right"),"rtl"==a){var g=l;l=h,h=g}p=l.left,m=h.right}null==r&&0==e&&(p=u),h.top-l.top>3&&(n(p,l.top,null,l.bottom),p=u,l.bottom<h.top&&n(p,l.bottom,null,h.top)),null==i&&t==s&&(m=c),(!d||l.top<d.top||l.top==d.top&&l.left<d.left)&&(d=l),(!f||h.bottom>f.bottom||h.bottom==f.bottom&&h.right>f.right)&&(f=h),u+1>p&&(p=u),n(p,h.top,m-p,h.bottom)}),{start:d,end:f}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=Se(e.display),u=s.left,c=o.lineSpace.offsetWidth-s.right,d=t.from(),f=t.to();if(d.line==f.line)i(d.line,d.ch,f.ch);else{var h=bn(a,d.line),p=bn(a,f.line),m=Br(h)==Br(p),g=i(d.line,d.ch,m?h.text.length+1:null).end,v=i(f.line,m?0:null,f.ch).start;m&&(g.top<v.top-2?(n(g.right,g.top,null,g.bottom),n(u,v.top,v.left,v.bottom)):n(g.right,g.top,v.left-g.right,g.bottom)),g.bottom<v.top&&n(u,g.bottom,null,v.top)}r.appendChild(l)}function ye(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0&&(t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate))}}function be(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,oi(we,e))}function we(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=So(t.mode,ke(e,t.frontier));Ze(e,function(){t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(i){if(t.frontier>=e.display.viewFrom){var o=i.styles,a=tn(e,i,n,!0);i.styles=a.styles,a.classes?i.styleClasses=a.classes:i.styleClasses&&(i.styleClasses=null);for(var l=!o||o.length!=i.styles.length,s=0;!l&&s<o.length;++s)l=o[s]!=i.styles[s];l&&it(e,t.frontier,"text"),i.stateAfter=So(t.mode,n)}else nn(e,i.text,n),i.stateAfter=t.frontier%5==0?So(t.mode,n):null;return++t.frontier,+new Date>r?(be(e,e.options.workDelay),!0):void 0})})}}function xe(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=bn(o,l-1);if(s.stateAfter&&(!r||l<=o.frontier))return l;var u=na(s.text,null,e.options.tabSize);(null==i||n>u)&&(i=l-1,n=u)}return i}function ke(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=xe(e,t,r),a=o>n.first&&bn(n,o-1).stateAfter;return a=a?So(n.mode,a):Mo(n.mode),n.iter(o,t,function(r){nn(e,r.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=l?So(n.mode,a):null,++o}),r&&(n.frontier=o),a}function Ce(e){return e.lineSpace.offsetTop}function Le(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Se(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=ci(e.measure,si("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Me(e,t,r){var n=e.options.lineWrapping,i=n&&e.display.scroller.clientWidth;if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],u=a[l+1];Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Te(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var n=0;n<e.rest.length;n++)if(Cn(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Ae(e,t){t=Br(t);var r=Cn(t),n=e.display.externalMeasured=new tt(e.doc,t,r);n.lineN=r;var i=n.built=an(e,n);return n.text=i.pre,ci(e.display.lineMeasure,i.pre),n}function Ne(e,t,r,n){return ze(e,Oe(e,t),r,n)}function He(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[at(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Oe(e,t){var r=Cn(t),n=He(e,r);n&&!n.text?n=null:n&&n.changes&&O(e,n,r,N(e)),n||(n=Ae(e,t));var i=Te(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function ze(e,t,r,n){t.before&&(r=-1);var i=r+(n||""),o;return t.cache.hasOwnProperty(i)?o=t.cache[i]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Me(e,t.view,t.rect),t.hasHeights=!0),o=Ee(e,t,r,n),o.bogus||(t.cache[i]=o)),{left:o.left,right:o.right,top:o.top,bottom:o.bottom}}function Ee(e,t,r,n){for(var i=t.map,o,a,l,s,u=0;u<i.length;u+=3){var c=i[u],d=i[u+1];if(c>r?(a=0,l=1,s="left"):d>r?(a=r-c,l=a+1):(u==i.length-3||r==d&&i[u+3]>r)&&(l=d-c,a=l-1,r>=d&&(s="right")),null!=a){if(o=i[u+2],c==d&&n==(o.insertLeft?"left":"right")&&(s=n),"left"==n&&0==a)for(;u&&i[u-2]==i[u-3]&&i[u-1].insertLeft;)o=i[(u-=3)+2],s="left";if("right"==n&&a==d-c)for(;u<i.length-3&&i[u+3]==i[u+4]&&!i[u+5].insertLeft;)o=i[(u+=3)+2],s="right";break}}var f;if(3==o.nodeType){for(;a&&li(t.line.text.charAt(c+a));)--a;for(;d>c+l&&li(t.line.text.charAt(c+l));)++l;if(Ii&&0==a&&l==d-c)f=o.parentNode.getBoundingClientRect();else if(_i&&e.options.lineWrapping){var h=ua(o,a,l).getClientRects();f=h.length?h["right"==n?h.length-1:0]:io}else f=ua(o,a,l).getBoundingClientRect()}else{a>0&&(s=n="right");var h;f=e.options.lineWrapping&&(h=o.getClientRects()).length>1?h["right"==n?h.length-1:0]:o.getBoundingClientRect()}if(Ii&&!a&&(!f||!f.left&&!f.right)){var p=o.parentNode.getClientRects()[0];f=p?{left:p.left,right:p.left+$e(e.display),top:p.top,bottom:p.bottom}:io}for(var m,g=(f.bottom+f.top)/2-t.rect.top,v=t.view.measure.heights,u=0;u<v.length-1&&!(g<v[u]);u++);m=u?v[u-1]:0,g=v[u];var y={left:("right"==s?f.right:f.left)-t.rect.left,right:("left"==s?f.left:f.right)-t.rect.left,top:m,bottom:g};return f.left||f.right||(y.bogus=!0),y}function We(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 Ie(e){e.display.externalMeasure=null,ui(e.display.lineMeasure);
2
- for(var t=0;t<e.display.view.length;t++)We(e.display.view[t])}function De(e){Ie(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Pe(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function _e(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function Fe(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=Kr(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=Sn(t);if("local"==n?a+=Ce(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:_e());var s=l.left+("window"==n?0:Pe());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function Be(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=Pe(),i-=_e();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function Re(e,t,r,n,i){return n||(n=bn(e.doc,t.line)),Fe(e,n,Ne(e,n,t.ch,i),r)}function je(e,t,r,n,i){function o(t,o){var a=ze(e,i,t,o?"right":"left");return o?a.left=a.right:a.right=a.left,Fe(e,n,a,r)}function a(e,t){var r=l[t],n=r.level%2;return e==xi(r)&&t&&r.level<l[t-1].level?(r=l[--t],e=ki(r)-(r.level%2?0:1),n=!0):e==ki(r)&&t<l.length-1&&r.level<l[t+1].level&&(r=l[++t],e=xi(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?o(e-1):o(e,n)}n=n||bn(e.doc,t.line),i||(i=Oe(e,n));var l=Mn(n),s=t.ch;if(!l)return o(s);var u=Ai(l,s),c=a(s,u);return null!=ya&&(c.other=a(s,ya)),c}function Ve(e,t){var r=0,t=Q(e.doc,t);e.options.lineWrapping||(r=$e(e.display)*t.ch);var n=bn(e.doc,t.line),i=Sn(n)+Ce(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function Ge(e,t,r,n){var i=ro(e,t);return i.xRel=n,r&&(i.outside=!0),i}function qe(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return Ge(n.first,0,!0,-1);var i=Ln(n,r),o=n.first+n.size-1;if(i>o)return Ge(n.first+n.size-1,bn(n,o).text.length,!0,1);0>t&&(t=0);for(var a=bn(n,i);;){var l=Ue(e,a,i,t,r),s=_r(a),u=s&&s.find(0,!0);if(!s||!(l.ch>u.from.ch||l.ch==u.from.ch&&l.xRel>0))return l;i=Cn(a=u.to.line)}}function Ue(e,t,r,n,i){function o(n){var i=je(e,ro(r,n),"line",t,u);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-Sn(t),l=!1,s=2*e.display.wrapper.clientWidth,u=Oe(e,t),c=Mn(t),d=t.text.length,f=Ci(t),h=Li(t),p=o(f),m=l,g=o(h),v=l;if(n>g)return Ge(r,h,v,1);for(;;){if(c?h==f||h==Hi(t,f,1):1>=h-f){for(var y=p>n||g-n>=n-p?f:h,b=n-(y==f?p:g);li(t.text.charAt(y));)++y;var w=Ge(r,y,y==f?m:v,-1>b?-1:b>1?1:0);return w}var x=Math.ceil(d/2),k=f+x;if(c){k=f;for(var C=0;x>C;++C)k=Hi(t,k,1)}var L=o(k);L>n?(h=k,g=L,(v=l)&&(g+=1e3),d=x):(f=k,p=L,m=l,d-=x)}}function Ke(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==oo){oo=si("pre");for(var t=0;49>t;++t)oo.appendChild(document.createTextNode("x")),oo.appendChild(si("br"));oo.appendChild(document.createTextNode("x"))}ci(e.measure,oo);var r=oo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),ui(e.measure),r||1}function $e(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=si("span","xxxxxxxxxx"),r=si("pre",[t]);ci(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ye(e){e.curOp={viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++ao},Zo++||(Xo=[])}function Xe(e){var t=e.curOp,r=e.doc,n=e.display;if(e.curOp=null,t.updateMaxLine&&h(e),t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<n.viewFrom||t.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping){var i=k(e,{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate);e.display.scroller.offsetHeight&&(e.doc.scrollTop=e.display.scroller.scrollTop)}if(!i&&t.selectionChanged&&me(e),i||t.startHeight==e.doc.height||g(e),null!=t.scrollTop&&n.scroller.scrollTop!=t.scrollTop){var o=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,t.scrollTop));n.scroller.scrollTop=n.scrollbarV.scrollTop=r.scrollTop=o}if(null!=t.scrollLeft&&n.scroller.scrollLeft!=t.scrollLeft){var a=Math.max(0,Math.min(n.scroller.scrollWidth-n.scroller.clientWidth,t.scrollLeft));n.scroller.scrollLeft=n.scrollbarH.scrollLeft=r.scrollLeft=a,y(e)}if(t.scrollToPos){var l=rr(e,Q(e.doc,t.scrollToPos.from),Q(e.doc,t.scrollToPos.to),t.scrollToPos.margin);t.scrollToPos.isCursor&&e.state.focused&&tr(e,l)}t.selectionChanged&&ye(e),e.state.focused&&t.updateInput&&ht(e,t.typing);var s=t.maybeHiddenMarkers,u=t.maybeUnhiddenMarkers;if(s)for(var c=0;c<s.length;++c)s[c].lines.length||Yo(s[c],"hide");if(u)for(var c=0;c<u.length;++c)u[c].lines.length&&Yo(u[c],"unhide");var d;if(--Zo||(d=Xo,Xo=null),t.changeObjs&&Yo(e,"changes",e,t.changeObjs),d)for(var c=0;c<d.length;++c)d[c]();if(t.cursorActivityHandlers)for(var c=0;c<t.cursorActivityHandlers.length;c++)t.cursorActivityHandlers[c](e)}function Ze(e,t){if(e.curOp)return t();Ye(e);try{return t()}finally{Xe(e)}}function Qe(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ye(e);try{return t.apply(e,arguments)}finally{Xe(e)}}}function Je(e){return function(){if(this.curOp)return e.apply(this,arguments);Ye(this);try{return e.apply(this,arguments)}finally{Xe(this)}}}function et(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Ye(t);try{return e.apply(this,arguments)}finally{Xe(t)}}}function tt(e,t,r){this.line=t,this.rest=Rr(t),this.size=this.rest?Cn(ei(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Gr(e,t)}function rt(e,t,r){for(var n=[],i,o=t;r>o;o=i){var a=new tt(e.doc,bn(e.doc,o),o);i=o+a.size,n.push(a)}return n}function nt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)to&&jr(e.doc,t)<i.viewTo&&ot(e);else if(r<=i.viewFrom)to&&Vr(e.doc,r+n)>i.viewFrom?ot(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)ot(e);else if(t<=i.viewFrom){var o=lt(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):ot(e)}else if(r>=i.viewTo){var o=lt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):ot(e)}else{var a=lt(e,t,t,-1),l=lt(e,r,r+n,1);a&&l?(i.view=i.view.slice(0,a.index).concat(rt(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=n):ot(e)}var s=i.externalMeasured;s&&(r<s.lineN?s.lineN+=n:t<s.lineN+s.size&&(i.externalMeasured=null))}function it(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[at(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==ti(a,r)&&a.push(r)}}}function ot(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function at(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,0>t)return n}function lt(e,t,r,n){var i=at(e,t),o,a=e.display.view;if(!to)return{index:i,lineN:r};for(var l=0,s=e.display.viewFrom;i>l;l++)s+=a[l].size;if(s!=t){if(n>0){if(i==a.length-1)return null;o=s+a[i].size-t,i++}else o=s-t;t+=o,r+=o}for(;jr(e.doc,r)!=r;){if(i==(0>n?0:a.length-1))return null;r+=n*a[i-(0>n?1:0)].size,i+=n}return{index:i,lineN:r}}function st(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=rt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=rt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(at(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(rt(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,at(e,r)))),n.viewTo=r}function ut(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function ct(e){e.display.pollingFast||e.display.poll.set(e.options.pollInterval,function(){ft(e),e.state.focused&&ct(e)})}function dt(e){function t(){var n=ft(e);n||r?(e.display.pollingFast=!1,ct(e)):(r=!0,e.display.poll.set(60,t))}var r=!1;e.display.pollingFast=!0,e.display.poll.set(20,t)}function ft(e){var t=e.display.input,r=e.display.prevInput,n=e.doc;if(!e.state.focused||ma(t)&&!r||gt(e)||e.options.disableInput)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var i=t.value;if(i==r&&!e.somethingSelected())return!1;if(_i&&!Ii&&e.display.inputHasSelection===i)return ht(e),!1;var o=!e.curOp;o&&Ye(e),e.display.shift=!1;for(var a=0,l=Math.min(r.length,i.length);l>a&&r.charCodeAt(a)==i.charCodeAt(a);)++a;for(var s=i.slice(a),u=pa(s),c=e.state.pasteIncoming&&u.length>1&&n.sel.ranges.length==u.length,d=n.sel.ranges.length-1;d>=0;d--){var f=n.sel.ranges[d],h=f.from(),p=f.to();a<r.length?h=ro(h.line,h.ch-(r.length-a)):e.state.overwrite&&f.empty()&&!e.state.pasteIncoming&&(p=ro(p.line,Math.min(bn(n,p.line).text.length,p.ch+ei(u).length)));var m=e.curOp.updateInput,g={from:h,to:p,text:c?[u[d]]:u,origin:e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input"};if($t(e.doc,g),qn(e,"inputRead",e,g),s&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&f.head.ch<100&&(!d||n.sel.ranges[d-1].head.line!=f.head.line)){var v=e.getModeAt(f.head);if(v.electricChars){for(var y=0;y<v.electricChars.length;y++)if(s.indexOf(v.electricChars.charAt(y))>-1){sr(e,f.head.line,"smart");break}}else if(v.electricInput){var b=go(g);v.electricInput.test(bn(n,b.line).text.slice(0,b.ch))&&sr(e,f.head.line,"smart")}}}return ar(e),e.curOp.updateInput=m,e.curOp.typing=!0,i.length>1e3||i.indexOf("\n")>-1?t.value=e.display.prevInput="":e.display.prevInput=i,o&&Xe(e),e.state.pasteIncoming=e.state.cutIncoming=!1,!0}function ht(e,t){var r,n,i=e.doc;if(e.somethingSelected()){e.display.prevInput="";var o=i.sel.primary();r=ga&&(o.to().line-o.from().line>100||(n=e.getSelection()).length>1e3);var a=r?"-":n||e.getSelection();e.display.input.value=a,e.state.focused&&oa(e.display.input),_i&&!Ii&&(e.display.inputHasSelection=a)}else t||(e.display.prevInput=e.display.input.value="",_i&&!Ii&&(e.display.inputHasSelection=null));e.display.inaccurateSelection=r}function pt(e){"nocursor"==e.options.readOnly||$i&&fi()==e.display.input||e.display.input.focus()}function mt(e){e.state.focused||(pt(e),Ft(e))}function gt(e){return e.options.readOnly||e.doc.cantEdit}function vt(e){function t(){e.state.focused&&setTimeout(oi(pt,e),0)}function r(){null==l&&(l=setTimeout(function(){l=null,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=da=null,e.setSize()},100))}function n(){di(document.body,a.wrapper)?setTimeout(n,5e3):$o(window,"resize",r)}function i(t){Kn(e,t)||Uo(t)}function o(t){if(e.somethingSelected())a.inaccurateSelection&&(a.prevInput="",a.inaccurateSelection=!1,a.input.value=e.getSelection(),oa(a.input));else{for(var r="",n=[],i=0;i<e.doc.sel.ranges.length;i++){var o=e.doc.sel.ranges[i].head.line,l={anchor:ro(o,0),head:ro(o+1,0)};n.push(l),r+=e.getRange(l.anchor,l.head)}"cut"==t.type?e.setSelections(n,null,ea):(a.prevInput="",a.input.value=r,oa(a.input))}"cut"==t.type&&(e.state.cutIncoming=!0)}var a=e.display;Ko(a.scroller,"mousedown",Qe(e,wt)),Ei?Ko(a.scroller,"dblclick",Qe(e,function(t){if(!Kn(e,t)){var r=bt(e,t);if(r&&!St(e,t)&&!yt(e.display,t)){Go(t);var n=hr(e.doc,r);ne(e.doc,n.anchor,n.head)}}})):Ko(a.scroller,"dblclick",function(t){Kn(e,t)||Go(t)}),Ko(a.lineSpace,"selectstart",function(e){yt(a,e)||Go(e)}),Ji||Ko(a.scroller,"contextmenu",function(t){Rt(e,t)}),Ko(a.scroller,"scroll",function(){a.scroller.clientHeight&&(At(e,a.scroller.scrollTop),Nt(e,a.scroller.scrollLeft,!0),Yo(e,"scroll",e))}),Ko(a.scrollbarV,"scroll",function(){a.scroller.clientHeight&&At(e,a.scrollbarV.scrollTop)}),Ko(a.scrollbarH,"scroll",function(){a.scroller.clientHeight&&Nt(e,a.scrollbarH.scrollLeft)}),Ko(a.scroller,"mousewheel",function(t){Ht(e,t)}),Ko(a.scroller,"DOMMouseScroll",function(t){Ht(e,t)}),Ko(a.scrollbarH,"mousedown",t),Ko(a.scrollbarV,"mousedown",t),Ko(a.wrapper,"scroll",function(){a.wrapper.scrollTop=a.wrapper.scrollLeft=0});var l;Ko(window,"resize",r),setTimeout(n,5e3),Ko(a.input,"keyup",Qe(e,Pt)),Ko(a.input,"input",function(){_i&&!Ii&&e.display.inputHasSelection&&(e.display.inputHasSelection=null),dt(e)}),Ko(a.input,"keydown",Qe(e,It)),Ko(a.input,"keypress",Qe(e,_t)),Ko(a.input,"focus",oi(Ft,e)),Ko(a.input,"blur",oi(Bt,e)),e.options.dragDrop&&(Ko(a.scroller,"dragstart",function(t){Tt(e,t)}),Ko(a.scroller,"dragenter",i),Ko(a.scroller,"dragover",i),Ko(a.scroller,"drop",Qe(e,Mt))),Ko(a.scroller,"paste",function(t){yt(a,t)||(e.state.pasteIncoming=!0,pt(e),dt(e))}),Ko(a.input,"paste",function(){if(Fi&&!e.state.fakedLastChar&&!(new Date-e.state.lastMiddleDown<200)){var t=a.input.selectionStart,r=a.input.selectionEnd;a.input.value+="$",a.input.selectionStart=t,a.input.selectionEnd=r,e.state.fakedLastChar=!0}e.state.pasteIncoming=!0,dt(e)}),Ko(a.input,"cut",o),Ko(a.input,"copy",o),Gi&&Ko(a.sizer,"mouseup",function(){fi()==a.input&&a.input.blur(),pt(e)})}function yt(e,t){for(var r=Vn(t);r!=e.wrapper;r=r.parentNode)if(!r||r.ignoreEvents||r.parentNode==e.sizer&&r!=e.mover)return!0}function bt(e,t,r,n){var i=e.display;if(!r){var o=Vn(t);if(o==i.scrollbarH||o==i.scrollbarV||o==i.scrollbarFiller||o==i.gutterFiller)return null}var a,l,s=i.lineSpace.getBoundingClientRect();try{a=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var u=qe(e,a,l),c;if(n&&1==u.xRel&&(c=bn(e.doc,u.line).text).length==u.ch){var d=na(c,c.length,e.options.tabSize)-c.length;u=ro(u.line,Math.max(0,Math.round((a-Se(e.display).left)/$e(e.display))-d))}return u}function wt(e){if(!Kn(this,e)){var t=this,r=t.display;if(r.shift=e.shiftKey,yt(r,e))return void(Fi||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!St(t,e)){var n=bt(t,e);switch(window.focus(),Gn(e)){case 1:n?xt(t,e,n):Vn(e)==r.scroller&&Go(e);break;case 2:Fi&&(t.state.lastMiddleDown=+new Date),n&&ne(t.doc,n),setTimeout(oi(pt,t),20),Go(e);break;case 3:Ji&&Rt(t,e)}}}}function xt(e,t,r){setTimeout(oi(mt,e),0);var n=+new Date,i;so&&so.time>n-400&&0==no(so.pos,r)?i="triple":lo&&lo.time>n-400&&0==no(lo.pos,r)?(i="double",so={time:n,pos:r}):(i="single",lo={time:n,pos:r});var o=e.doc.sel,a=Yi?t.metaKey:t.ctrlKey;e.options.dragDrop&&ca&&!a&&!gt(e)&&"single"==i&&o.contains(r)>-1&&o.somethingSelected()?kt(e,t,r):Ct(e,t,r,i,a)}function kt(e,t,r){var n=e.display,i=Qe(e,function(o){Fi&&(n.scroller.draggable=!1),e.state.draggingText=!1,$o(document,"mouseup",i),$o(n.scroller,"drop",i),Math.abs(t.clientX-o.clientX)+Math.abs(t.clientY-o.clientY)<10&&(Go(o),ne(e.doc,r),pt(e),Ei&&!Ii&&setTimeout(function(){document.body.focus(),pt(e)},20))});Fi&&(n.scroller.draggable=!0),e.state.draggingText=i,n.scroller.dragDrop&&n.scroller.dragDrop(),Ko(document,"mouseup",i),Ko(n.scroller,"drop",i)}function Ct(e,t,r,n,i){function o(t){if(0!=no(m,t))if(m=t,"rect"==n){for(var i=[],o=e.options.tabSize,a=na(bn(u,r.line).text,r.ch,o),l=na(bn(u,t.line).text,t.ch,o),s=Math.min(a,l),h=Math.max(a,l),p=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));g>=p;p++){var v=bn(u,p).text,y=Qn(v,s,o);s==h?i.push(new K(ro(p,y),ro(p,y))):v.length>y&&i.push(new K(ro(p,y),ro(p,Qn(v,h,o))))}i.length||i.push(new K(r,r)),ue(u,Y(f.ranges.slice(0,d).concat(i),d),ta)}else{var b=c,w=b.anchor,x=t;if("single"!=n){if("double"==n)var k=hr(u,t);else var k=new K(ro(t.line,0),Q(u,ro(t.line+1,0)));no(k.anchor,w)>0?(x=k.head,w=q(b.from(),k.anchor)):(x=k.anchor,w=G(b.to(),k.head))}var i=f.ranges.slice(0);i[d]=new K(Q(u,w),x),ue(u,Y(i,d),ta)}}function a(t){var r=++y,i=bt(e,t,!0,"rect"==n);if(i)if(0!=no(i,m)){mt(e),o(i);var l=v(s,u);(i.line>=l.to||i.line<l.from)&&setTimeout(Qe(e,function(){y==r&&a(t)}),150)}else{var c=t.clientY<g.top?-20:t.clientY>g.bottom?20:0;c&&setTimeout(Qe(e,function(){y==r&&(s.scroller.scrollTop+=c,a(t))}),50)}}function l(t){y=1/0,Go(t),pt(e),$o(document,"mousemove",b),$o(document,"mouseup",w),u.history.lastSelOrigin=null}var s=e.display,u=e.doc;Go(t);var c,d,f=u.sel;if(i&&!t.shiftKey?(d=u.sel.contains(r),c=d>-1?u.sel.ranges[d]:new K(r,r)):c=u.sel.primary(),t.altKey)n="rect",i||(c=new K(r,r)),r=bt(e,t,!0,!0),d=-1;else if("double"==n){var h=hr(u,r);c=e.display.shift||u.extend?re(u,c,h.anchor,h.head):h}else if("triple"==n){var p=new K(ro(r.line,0),Q(u,ro(r.line+1,0)));c=e.display.shift||u.extend?re(u,c,p.anchor,p.head):p}else c=re(u,c,r);i?d>-1?oe(u,d,c,ta):(d=u.sel.ranges.length,ue(u,Y(u.sel.ranges.concat([c]),d),{scroll:!1,origin:"*mouse"})):(d=0,ue(u,new U([c],0),ta),f=u.sel);var m=r,g=s.wrapper.getBoundingClientRect(),y=0,b=Qe(e,function(e){(_i&&!Di?e.buttons:Gn(e))?a(e):l(e)}),w=Qe(e,l);Ko(document,"mousemove",b),Ko(document,"mouseup",w)}function Lt(e,t,r,n,i){try{var o=t.clientX,a=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Go(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(a>s.bottom||!Yn(e,r))return jn(t);a-=s.top-l.viewOffset;for(var u=0;u<e.options.gutters.length;++u){var c=l.gutters.childNodes[u];if(c&&c.getBoundingClientRect().right>=o){var d=Ln(e.doc,a),f=e.options.gutters[u];return i(e,r,e,d,f,t),jn(t)}}}function St(e,t){return Lt(e,t,"gutterClick",!0,qn)}function Mt(e){var t=this;if(!Kn(t,e)&&!yt(t.display,e)){Go(e),_i&&(uo=+new Date);var r=bt(t,e,!0),n=e.dataTransfer.files;if(r&&!gt(t))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,l=function(e,n){var l=new FileReader;l.onload=Qe(t,function(){if(o[n]=l.result,++a==i){r=Q(t.doc,r);var e={from:r,to:r,text:pa(o.join("\n")),origin:"paste"};$t(t.doc,e),se(t.doc,X(r,go(e)))}}),l.readAsText(e)},s=0;i>s;++s)l(n[s],s);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(oi(pt,t),20);try{var o=e.dataTransfer.getData("Text");if(o){var u=t.state.draggingText&&t.listSelections();if(ce(t.doc,X(r,r)),u)for(var s=0;s<u.length;++s)er(t.doc,"",u[s].anchor,u[s].head,"drag");t.replaceSelection(o,"around","paste"),pt(t)}}catch(e){}}}}function Tt(e,t){if(_i&&(!e.state.draggingText||+new Date-uo<100))return void Uo(t);if(!Kn(e,t)&&!yt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!Vi)){var r=si("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",ji&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),ji&&r.parentNode.removeChild(r)}}function At(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,zi||k(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbarV.scrollTop!=t&&(e.display.scrollbarV.scrollTop=t),zi&&k(e),be(e,100))}function Nt(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,y(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbarH.scrollLeft!=t&&(e.display.scrollbarH.scrollLeft=t))}function Ht(e,t){var r=t.wheelDeltaX,n=t.wheelDeltaY;null==r&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(r=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta);var i=e.display,o=i.scroller;if(r&&o.scrollWidth>o.clientWidth||n&&o.scrollHeight>o.clientHeight){if(n&&Yi&&Fi)e:for(var a=t.target,l=i.view;a!=o;a=a.parentNode)for(var s=0;s<l.length;s++)if(l[s].node==a){e.display.currentWheelTarget=a;break e}if(r&&!zi&&!ji&&null!=fo)return n&&At(e,Math.max(0,Math.min(o.scrollTop+n*fo,o.scrollHeight-o.clientHeight))),Nt(e,Math.max(0,Math.min(o.scrollLeft+r*fo,o.scrollWidth-o.clientWidth))),Go(t),void(i.wheelStartX=null);if(n&&null!=fo){var u=n*fo,c=e.doc.scrollTop,d=c+i.wrapper.clientHeight;0>u?c=Math.max(0,c+u-50):d=Math.min(e.doc.height,d+u+50),k(e,{top:c,bottom:d})}20>co&&(null==i.wheelStartX?(i.wheelStartX=o.scrollLeft,i.wheelStartY=o.scrollTop,i.wheelDX=r,i.wheelDY=n,setTimeout(function(){if(null!=i.wheelStartX){var e=o.scrollLeft-i.wheelStartX,t=o.scrollTop-i.wheelStartY,r=t&&i.wheelDY&&t/i.wheelDY||e&&i.wheelDX&&e/i.wheelDX;i.wheelStartX=i.wheelStartY=null,r&&(fo=(fo*co+r)/(co+1),++co)}},200)):(i.wheelDX+=r,i.wheelDY+=n))}}function Ot(e,t,r){if("string"==typeof t&&(t=To[t],!t))return!1;e.display.pollingFast&&ft(e)&&(e.display.pollingFast=!1);var n=e.display.shift,i=!1;try{gt(e)&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Jo}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function zt(e){var t=e.state.keyMaps.slice(0);return e.options.extraKeys&&t.push(e.options.extraKeys),t.push(e.options.keyMap),t}function Et(e,t){var r=mr(e.options.keyMap),n=r.auto;clearTimeout(ho),n&&!Ho(t)&&(ho=setTimeout(function(){mr(e.options.keyMap)==r&&(e.options.keyMap=n.call?n.call(null,e):n,l(e))},50));var i=Oo(t,!0),o=!1;if(!i)return!1;var a=zt(e);return o=t.shiftKey?No("Shift-"+i,a,function(t){return Ot(e,t,!0)})||No(i,a,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?Ot(e,t):void 0}):No(i,a,function(t){return Ot(e,t)}),o&&(Go(t),ye(e),qn(e,"keyHandled",e,i,t)),o}function Wt(e,t,r){var n=No("'"+r+"'",zt(e),function(t){return Ot(e,t,!0)});return n&&(Go(t),ye(e),qn(e,"keyHandled",e,"'"+r+"'",t)),n}function It(e){var t=this;if(mt(t),!Kn(t,e)){Ei&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=Et(t,e);ji&&(po=n?r:null,!n&&88==r&&!ga&&(Yi?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||Dt(t)}}function Dt(e){function t(e){18!=e.keyCode&&e.altKey||(pi(r,"CodeMirror-crosshair"),$o(document,"keyup",t),$o(document,"mouseover",t))}var r=e.display.lineDiv;mi(r,"CodeMirror-crosshair"),Ko(document,"keyup",t),Ko(document,"mouseover",t)}function Pt(e){Kn(this,e)||16==e.keyCode&&(this.doc.sel.shift=!1)}function _t(e){var t=this;if(!Kn(t,e)){var r=e.keyCode,n=e.charCode;if(ji&&r==po)return po=null,void Go(e);if(!(ji&&(!e.which||e.which<10)||Gi)||!Et(t,e)){var i=String.fromCharCode(null==n?r:n);Wt(t,e,i)||(_i&&!Ii&&(t.display.inputHasSelection=null),dt(t))}}}function Ft(e){"nocursor"!=e.options.readOnly&&(e.state.focused||(Yo(e,"focus",e),e.state.focused=!0,mi(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu!=e.doc.sel||(ht(e),Fi&&setTimeout(oi(ht,e,!0),0))),ct(e),ye(e))}function Bt(e){e.state.focused&&(Yo(e,"blur",e),e.state.focused=!1,pi(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Rt(e,t){function r(){if(null!=i.input.selectionStart){var t=e.somethingSelected(),r=i.input.value="​"+(t?i.input.value:"");i.prevInput=t?"":"​",i.input.selectionStart=1,i.input.selectionEnd=r.length}}function n(){if(i.inputDiv.style.position="relative",i.input.style.cssText=s,Ii&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=a),ct(e),null!=i.input.selectionStart){(!_i||Ii)&&r(),clearTimeout(mo);var t=0,n=function(){i.selForContextMenu==e.doc.sel&&0==i.input.selectionStart?Qe(e,To.selectAll)(e):t++<10?mo=setTimeout(n,500):ht(e)};mo=setTimeout(n,200)}}if(!Kn(e,t,"contextmenu")){var i=e.display;if(!yt(i,t)&&!jt(e,t)){var o=bt(e,t),a=i.scroller.scrollTop;if(o&&!ji){var l=e.options.resetSelectionOnContextMenu;l&&-1==e.doc.sel.contains(o)&&Qe(e,ue)(e.doc,X(o),ea);var s=i.input.style.cssText;if(i.inputDiv.style.position="absolute",i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(t.clientY-5)+"px; left: "+(t.clientX-5)+"px; z-index: 1000; background: "+(_i?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",pt(e),ht(e),e.somethingSelected()||(i.input.value=i.prevInput=" "),i.selForContextMenu=e.doc.sel,_i&&!Ii&&r(),Ji){Uo(t);var u=function(){$o(window,"mouseup",u),setTimeout(n,20)};Ko(window,"mouseup",u)}else setTimeout(n,50)}}}}function jt(e,t){return Yn(e,"gutterContextMenu")?Lt(e,t,"gutterContextMenu",!1,Yo):!1}function Vt(e,t){if(no(e,t.from)<0)return e;if(no(e,t.to)<=0)return go(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=go(t).ch-t.to.ch),ro(r,n)}function Gt(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new K(Vt(i.anchor,t),Vt(i.head,t)))}return Y(r,e.sel.primIndex)}function qt(e,t,r){return e.line==t.line?ro(r.line,e.ch-t.ch+r.ch):ro(r.line+(e.line-t.line),e.ch)}function Ut(e,t,r){for(var n=[],i=ro(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=qt(l.from,i,o),u=qt(go(l),i,o);if(i=l.to,o=u,"around"==r){var c=e.sel.ranges[a],d=no(c.head,c.anchor)<0;n[a]=new K(d?u:s,d?s:u)}else n[a]=new K(s,s)}return new U(n,e.sel.primIndex)}function Kt(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(t,r,n,i){t&&(this.from=Q(e,t)),r&&(this.to=Q(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),Yo(e,"beforeChange",e,n),e.cm&&Yo(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function $t(e,t,r){if(e.cm){if(!e.cm.curOp)return Qe(e.cm,$t)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Yn(e,"beforeChange")||e.cm&&Yn(e.cm,"beforeChange"))||(t=Kt(e,t,!0))){var n=eo&&!r&&Hr(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Yt(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Yt(e,t)}}function Yt(e,t){if(1!=t.text.length||""!=t.text[0]||0!=no(t.from,t.to)){var r=Gt(e,t);On(e,t,r,e.cm?e.cm.curOp.id:NaN),Qt(e,t,r,Tr(e,t));var n=[];vn(e,function(e,r){r||-1!=ti(n,e.history)||(Rn(e.history,t),n.push(e.history)),Qt(e,t,null,Tr(e,t))})}}function Xt(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n=e.history,i,o=e.sel,a="undo"==t?n.done:n.undone,l="undo"==t?n.undone:n.done,s=0;s<a.length&&(i=a[s],r?!i.ranges||i.equals(e.sel):i.ranges);s++);if(s!=a.length){for(n.lastOrigin=n.lastSelOrigin=null;i=a.pop(),i.ranges;){if(Wn(i,l),r&&!i.equals(e.sel))return void ue(e,i,{clearRedo:!1});o=i}var u=[];Wn(o,l),l.push({changes:u,generation:n.generation}),n.generation=i.generation||++n.maxGeneration;for(var c=Yn(e,"beforeChange")||e.cm&&Yn(e.cm,"beforeChange"),s=i.changes.length-1;s>=0;--s){var d=i.changes[s];if(d.origin=t,c&&!Kt(e,d,!1))return void(a.length=0);u.push(An(e,d));var f=s?Gt(e,d,null):ei(a);Qt(e,d,f,Nr(e,d)),e.cm&&ar(e.cm);var h=[];vn(e,function(e,t){t||-1!=ti(h,e.history)||(Rn(e.history,d),h.push(e.history)),Qt(e,d,null,Nr(e,d))})}}}}function Zt(e,t){e.first+=t,e.sel=new U(ri(e.sel.ranges,function(e){return new K(ro(e.anchor.line+t,e.anchor.ch),ro(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm&&nt(e.cm,e.first,e.first-t,t)}function Qt(e,t,r,n){if(e.cm&&!e.cm.curOp)return Qe(e.cm,Qt)(e,t,r,n);if(t.to.line<e.first)return void Zt(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Zt(e,i),t={from:ro(e.first,0),to:ro(t.to.line+i,t.to.ch),text:[ei(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:ro(o,bn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=wn(e,t.from,t.to),r||(r=Gt(e,t,null)),e.cm?Jt(e.cm,t,n):pn(e,t,n),ce(e,r,ea)}}function Jt(e,t,r){var n=e.doc,i=e.display,a=t.from,l=t.to,s=!1,u=a.line;e.options.lineWrapping||(u=Cn(Br(bn(n,a.line))),n.iter(u,l.line+1,function(e){return e==i.maxLine?(s=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&$n(e),pn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(u,a.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),be(e,400);var c=t.text.length-(l.line-a.line)-1;a.line!=l.line||1!=t.text.length||hn(e.doc,t)?nt(e,a.line,l.line+1,c):it(e,a.line,"text");var d=Yn(e,"changes"),h=Yn(e,"change");if(h||d){var p={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};h&&qn(e,"change",e,p),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}}function er(e,t,r,n,i){if(n||(n=r),no(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=pa(t)),$t(e,{from:r,to:n,text:t,origin:i})}function tr(e,t){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!Ui){var o=si("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-Ce(e.display))+"px; height: "+(t.bottom-t.top+Qo)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}function rr(e,t,r,n){for(null==n&&(n=0);;){var i=!1,o=je(e,t),a=r&&r!=t?je(e,r):o,l=ir(e,Math.min(o.left,a.left),Math.min(o.top,a.top)-n,Math.max(o.left,a.left),Math.max(o.bottom,a.bottom)+n),s=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=l.scrollTop&&(At(e,l.scrollTop),Math.abs(e.doc.scrollTop-s)>1&&(i=!0)),null!=l.scrollLeft&&(Nt(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(i=!0)),!i)return o}}function nr(e,t,r,n,i){var o=ir(e,t,r,n,i);null!=o.scrollTop&&At(e,o.scrollTop),null!=o.scrollLeft&&Nt(e,o.scrollLeft)}function ir(e,t,r,n,i){var o=e.display,a=Ke(e.display);0>r&&(r=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=o.scroller.clientHeight-Qo,u={},c=e.doc.height+Le(o),d=a>r,f=i>c-a;if(l>r)u.scrollTop=d?0:r;else if(i>l+s){var h=Math.min(r,(f?c:i)-s);h!=l&&(u.scrollTop=h)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=o.scroller.clientWidth-Qo;t+=o.gutters.offsetWidth,n+=o.gutters.offsetWidth;var g=o.gutters.offsetWidth,v=g+10>t;return p+g>t||v?(v&&(t=0),u.scrollLeft=Math.max(0,t-10-g)):n>m+p-3&&(u.scrollLeft=n+10-m),u}function or(e,t,r){(null!=t||null!=r)&&lr(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function ar(e){lr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?ro(t.line,t.ch-1):t,n=ro(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function lr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=Ve(e,t.from),n=Ve(e,t.to),i=ir(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function sr(e,t,r,n){var i=e.doc,o;null==r&&(r="add"),"smart"==r&&(e.doc.mode.indent?o=ke(e,t):r="prev");var a=e.options.tabSize,l=bn(i,t),s=na(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var u=l.text.match(/^\s*/)[0],c;if(n||/\S/.test(l.text)){if("smart"==r&&(c=e.doc.mode.indent(o,l.text.slice(u.length),l.text),c==Jo)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>i.first?na(bn(i,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)f+=a,d+=" ";if(c>f&&(d+=Jn(c-f)),d!=u)er(e.doc,d,ro(t,0),ro(t,u.length),"+input");else for(var h=0;h<i.sel.ranges.length;h++){var p=i.sel.ranges[h];if(p.head.line==t&&p.head.ch<u.length){var f=ro(t,u.length);oe(i,h,new K(f,f));break}}l.stateAfter=null}function ur(e,t,r,n){var i=t,o=t,a=e.doc;return"number"==typeof t?o=bn(a,Z(a,t)):i=Cn(t),null==i?null:(n(o,i)&&it(e,i,r),o)}function cr(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&no(o.from,ei(n).to)<=0;){var a=n.pop();if(no(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}Ze(e,function(){for(var t=n.length-1;t>=0;t--)er(e.doc,"",n[t].from,n[t].to,"+delete");
3
- ar(e)})}function dr(e,t,r,n,i){function o(){var t=l+r;return t<e.first||t>=e.first+e.size?d=!1:(l=t,c=bn(e,t))}function a(e){var t=(i?Hi:Oi)(c,s,r,!0);if(null==t){if(e||!o())return d=!1;s=i?(0>r?Li:Ci)(c):0>r?c.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,u=r,c=bn(e,l),d=!0;if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var f=null,h="group"==n,p=!0;!(0>r)||a(!p);p=!1){var m=c.text.charAt(s)||"\n",g=la(m)?"w":h&&"\n"==m?"n":!h||/\s/.test(m)?null:"p";if(!h||p||g||(g="s"),f&&f!=g){0>r&&(r=1,a());break}if(g&&(f=g),r>0&&!a(!p))break}var v=pe(e,ro(l,s),u,!0);return d||(v.hitSide=!0),v}function fr(e,t,r,n){var i=e.doc,o=t.left,a;if("page"==n){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);a=t.top+r*(l-(0>r?1.5:.5)*Ke(e.display))}else"line"==n&&(a=r>0?t.bottom+3:t.top-3);for(;;){var s=qe(e,o,a);if(!s.outside)break;if(0>r?0>=a:a>=i.height){s.hitSide=!0;break}a+=5*r}return s}function hr(e,t){var r=bn(e,t.line).text,n=t.ch,i=t.ch;if(r){(t.xRel<0||i==r.length)&&n?--n:++i;for(var o=r.charAt(n),a=la(o)?la:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!la(e)};n>0&&a(r.charAt(n-1));)--n;for(;i<r.length&&a(r.charAt(i));)++i}return new K(ro(t.line,n),ro(t.line,i))}function pr(t,r,n,i){e.defaults[t]=r,n&&(yo[t]=i?function(e,t,r){r!=bo&&n(e,t,r)}:n)}function mr(e){return"string"==typeof e?Ao[e]:e}function gr(e,t,r,n,i){if(n&&n.shared)return vr(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Qe(e.cm,gr)(e,t,r,n,i);var o=new Eo(e,i),a=no(t,r);if(n&&ii(n,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=si("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||(o.widgetNode.ignoreEvents=!0),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Fr(e,t.line,t,r,o)||t.line!=r.line&&Fr(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");to=!0}o.addToHistory&&On(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var l=t.line,s=e.cm,u;if(e.iter(l,r.line+1,function(e){s&&o.collapsed&&!s.options.lineWrapping&&Br(e)==s.display.maxLine&&(u=!0),o.collapsed&&l!=t.line&&kn(e,0),Lr(e,new xr(o,l==t.line?t.ch:null,l==r.line?r.ch:null)),++l}),o.collapsed&&e.iter(t.line,r.line+1,function(t){Gr(e,t)&&kn(t,0)}),o.clearOnEnter&&Ko(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(eo=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Wo,o.atomic=!0),s){if(u&&(s.curOp.updateMaxLine=!0),o.collapsed)nt(s,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle)for(var c=t.line;c<=r.line;c++)it(s,c,"text");o.atomic&&fe(s.doc),qn(s,"markerAdded",s,o)}return o}function vr(e,t,r,n,i){n=ii(n),n.shared=!1;var o=[gr(e,t,r,n,i)],a=o[0],l=n.widgetNode;return vn(e,function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push(gr(e,Q(e,t),Q(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=ei(o)}),new Io(o,a)}function yr(e){return e.findMarks(ro(e.first,0),e.clipPos(ro(e.lastLine())),function(e){return e.parent})}function br(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(no(o,a)){var l=gr(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}function wr(e){for(var t=0;t<e.length;t++){var r=e[t],n=[r.primary.doc];vn(r.primary.doc,function(e){n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==ti(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}}}function xr(e,t,r){this.marker=e,this.from=t,this.to=r}function kr(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Cr(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Lr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Sr(e,t,r){if(e)for(var n=0,i;n<e.length;++n){var o=e[n],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(i||(i=[])).push(new xr(a,o.from,s?null:o.to))}}return i}function Mr(e,t,r){if(e)for(var n=0,i;n<e.length;++n){var o=e[n],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(i||(i=[])).push(new xr(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return i}function Tr(e,t){var r=ee(e,t.from.line)&&bn(e,t.from.line).markedSpans,n=ee(e,t.to.line)&&bn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==no(t.from,t.to),l=Sr(r,i,a),s=Mr(n,o,a),u=1==t.text.length,c=ei(t.text).length+(u?i:0);if(l)for(var d=0;d<l.length;++d){var f=l[d];if(null==f.to){var h=kr(s,f.marker);h?u&&(f.to=null==h.to?null:h.to+c):f.to=i}}if(s)for(var d=0;d<s.length;++d){var f=s[d];if(null!=f.to&&(f.to+=c),null==f.from){var h=kr(l,f.marker);h||(f.from=c,u&&(l||(l=[])).push(f))}else f.from+=c,u&&(l||(l=[])).push(f)}l&&(l=Ar(l)),s&&s!=l&&(s=Ar(s));var p=[l];if(!u){var m=t.text.length-2,g;if(m>0&&l)for(var d=0;d<l.length;++d)null==l[d].to&&(g||(g=[])).push(new xr(l[d].marker,null,null));for(var d=0;m>d;++d)p.push(g);p.push(s)}return p}function Ar(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Nr(e,t){var r=Pn(e,t),n=Tr(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function Hr(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=ti(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var u=i[s];if(!(no(u.to,l.from)<0||no(u.from,l.to)>0)){var c=[s,1],d=no(u.from,l.from),f=no(u.to,l.to);(0>d||!a.inclusiveLeft&&!d)&&c.push({from:u.from,to:l.from}),(f>0||!a.inclusiveRight&&!f)&&c.push({from:l.to,to:u.to}),i.splice.apply(i,c),s+=c.length-1}}return i}function Or(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function zr(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Er(e){return e.inclusiveLeft?-1:0}function Wr(e){return e.inclusiveRight?1:0}function Ir(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=no(n.from,i.from)||Er(e)-Er(t);if(o)return-o;var a=no(n.to,i.to)||Wr(e)-Wr(t);return a?a:t.id-e.id}function Dr(e,t){var r=to&&e.markedSpans,n;if(r)for(var i,o=0;o<r.length;++o)i=r[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!n||Ir(n,i.marker)<0)&&(n=i.marker);return n}function Pr(e){return Dr(e,!0)}function _r(e){return Dr(e,!1)}function Fr(e,t,r,n,i){var o=bn(e,t),a=to&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var u=s.marker.find(0),c=no(u.from,r)||Er(s.marker)-Er(i),d=no(u.to,n)||Wr(s.marker)-Wr(i);if(!(c>=0&&0>=d||0>=c&&d>=0)&&(0>=c&&(no(u.to,r)||Wr(s.marker)-Er(i))>0||c>=0&&(no(u.from,n)||Er(s.marker)-Wr(i))<0))return!0}}}function Br(e){for(var t;t=Pr(e);)e=t.find(-1,!0).line;return e}function Rr(e){for(var t,r;t=_r(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function jr(e,t){var r=bn(e,t),n=Br(r);return r==n?t:Cn(n)}function Vr(e,t){if(t>e.lastLine())return t;var r=bn(e,t),n;if(!Gr(e,r))return t;for(;n=_r(r);)r=n.find(1,!0).line;return Cn(r)+1}function Gr(e,t){var r=to&&t.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&qr(e,t,n))return!0}}function qr(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return qr(e,n.line,kr(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&qr(e,t,i))return!0}function Ur(e,t,r){Sn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&or(e,null,r)}function Kr(e){return null!=e.height?e.height:(di(document.body,e.node)||ci(e.cm.display.measure,si("div",[e.node],null,"position: relative")),e.height=e.node.offsetHeight)}function $r(e,t,r,n){var i=new Do(e,r,n);return i.noHScroll&&(e.display.alignWidgets=!0),ur(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,!Gr(e.doc,t)){var n=Sn(t)<e.doc.scrollTop;kn(t,t.height+Kr(i)),n&&or(e,null,i.height),e.curOp.forceUpdate=!0}return!0}),i}function Yr(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Or(e),zr(e,r);var i=n?n(e):1;i!=e.height&&kn(e,i)}function Xr(e){e.parent=null,Or(e)}function Zr(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Qr(t,r){if(t.blankLine)return t.blankLine(r);if(t.innerMode){var n=e.innerMode(t,r);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Jr(e,t,r){var n=e.token(t,r);if(t.pos<=t.start)throw new Error("Mode "+e.name+" failed to advance stream.");return n}function en(t,r,n,i,o,a,l){var s=n.flattenSpans;null==s&&(s=t.options.flattenSpans);var u=0,c=null,d=new zo(r,t.options.tabSize),f;for(""==r&&Zr(Qr(n,i),a);!d.eol();){if(d.pos>t.options.maxHighlightLength?(s=!1,l&&nn(t,r,i,d.pos),d.pos=r.length,f=null):f=Zr(Jr(n,d,i),a),t.options.addModeClass){var h=e.innerMode(n,i).mode.name;h&&(f="m-"+(f?h+" "+f:h))}s&&c==f||(u<d.start&&o(d.start,c),u=d.start,c=f),d.start=d.pos}for(;u<d.pos;){var p=Math.min(d.pos,u+5e4);o(p,c),u=p}}function tn(e,t,r,n){var i=[e.state.modeGen],o={};en(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},o,n);for(var a=0;a<e.state.overlays.length;++a){var l=e.state.overlays[a],s=1,u=0;en(e,t.text,l.mode,!0,function(e,t){for(var r=s;e>u;){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n),s+=2,u=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,s-r,e,"cm-overlay "+t),s=r+2;else for(;s>r;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function rn(e,t){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=tn(e,t,t.stateAfter=ke(e,Cn(t)));t.styles=r.styles,r.classes?t.styleClasses=r.classes:t.styleClasses&&(t.styleClasses=null)}return t.styles}function nn(e,t,r,n){var i=e.doc.mode,o=new zo(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&Qr(i,r);!o.eol()&&o.pos<=e.options.maxHighlightLength;)Jr(i,o,r),o.start=o.pos}function on(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Fo:_o;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function an(e,t){var r=si("span",null,null,Fi?"padding-right: .1px":null),n={pre:si("pre",[r]),content:r,col:0,pos:0,cm:e};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a;n.pos=0,n.addToken=sn,(_i||Fi)&&e.getOption("lineWrapping")&&(n.addToken=un(n.addToken)),bi(e.display.measure)&&(a=Mn(o))&&(n.addToken=cn(n.addToken,a)),n.map=[],fn(o,n,rn(e,o)),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=gi(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=gi(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(yi(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return Yo(e,"renderLine",e,t.line,n.pre),n}function ln(e){var t=si("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t}function sn(e,t,r,n,i,o){if(t){var a=e.cm.options.specialChars,l=!1;if(a.test(t))for(var s=document.createDocumentFragment(),u=0;;){a.lastIndex=u;var c=a.exec(t),d=c?c.index-u:t.length-u;if(d){var f=document.createTextNode(t.slice(u,u+d));Ii?s.appendChild(si("span",[f])):s.appendChild(f),e.map.push(e.pos,e.pos+d,f),e.col+=d,e.pos+=d}if(!c)break;if(u+=d+1," "==c[0]){var h=e.cm.options.tabSize,p=h-e.col%h,f=s.appendChild(si("span",Jn(p),"cm-tab"));e.col+=p}else{var f=e.cm.options.specialCharPlaceholder(c[0]);Ii?s.appendChild(si("span",[f])):s.appendChild(f),e.col+=1}e.map.push(e.pos,e.pos+1,f),e.pos++}else{e.col+=t.length;var s=document.createTextNode(t);e.map.push(e.pos,e.pos+t.length,s),Ii&&(l=!0),e.pos+=t.length}if(r||n||i||l){var m=r||"";n&&(m+=n),i&&(m+=i);var g=si("span",[s],m);return o&&(g.title=o),e.content.appendChild(g)}e.content.appendChild(s)}}function un(e){function t(e){for(var t=" ",r=0;r<e.length-2;++r)t+=r%2?" ":" ";return t+=" "}return function(r,n,i,o,a,l){e(r,n.replace(/ {3,}/g,t),i,o,a,l)}}function cn(e,t){return function(r,n,i,o,a,l){i=i?i+" cm-force-border":"cm-force-border";for(var s=r.pos,u=s+n.length;;){for(var c=0;c<t.length;c++){var d=t[c];if(d.to>s&&d.from<=s)break}if(d.to>=u)return e(r,n,i,o,a,l);e(r,n.slice(0,d.to-s),i,o,null,l),o=null,n=n.slice(d.to-s),s=d.to}}}function dn(e,t,r,n){var i=!n&&r.widgetNode;i&&(e.map.push(e.pos,e.pos+t,i),e.content.appendChild(i)),e.pos+=t}function fn(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a=i.length,l=0,s=1,u="",c,d=0,f,h,p,m,g;;){if(d==l){f=h=p=m="",g=null,d=1/0;for(var v=[],y=0;y<n.length;++y){var b=n[y],w=b.marker;b.from<=l&&(null==b.to||b.to>l)?(null!=b.to&&d>b.to&&(d=b.to,h=""),w.className&&(f+=" "+w.className),w.startStyle&&b.from==l&&(p+=" "+w.startStyle),w.endStyle&&b.to==d&&(h+=" "+w.endStyle),w.title&&!m&&(m=w.title),w.collapsed&&(!g||Ir(g.marker,w)<0)&&(g=b)):b.from>l&&d>b.from&&(d=b.from),"bookmark"==w.type&&b.from==l&&w.widgetNode&&v.push(w)}if(g&&(g.from||0)==l&&(dn(t,(null==g.to?a+1:g.to)-l,g.marker,null==g.from),null==g.to))return;if(!g&&v.length)for(var y=0;y<v.length;++y)dn(t,0,v[y])}if(l>=a)break;for(var x=Math.min(a,d);;){if(u){var k=l+u.length;if(!g){var C=k>x?u.slice(0,x-l):u;t.addToken(t,C,c?c+f:f,p,l+C.length==d?h:"",m)}if(k>=x){u=u.slice(x-l),l=x;break}l=k,p=""}u=i.slice(o,o=r[s++]),c=on(r[s++],t.cm.options)}}else for(var s=1;s<r.length;s+=2)t.addToken(t,i.slice(o,o=r[s]),on(r[s+1],t.cm.options))}function hn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==ei(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function pn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){Yr(e,r,i,n),qn(e,"change",e,t)}var a=t.from,l=t.to,s=t.text,u=bn(e,a.line),c=bn(e,l.line),d=ei(s),f=i(s.length-1),h=l.line-a.line;if(hn(e,t)){for(var p=0,m=[];p<s.length-1;++p)m.push(new Po(s[p],i(p),n));o(c,c.text,f),h&&e.remove(a.line,h),m.length&&e.insert(a.line,m)}else if(u==c)if(1==s.length)o(u,u.text.slice(0,a.ch)+d+u.text.slice(l.ch),f);else{for(var m=[],p=1;p<s.length-1;++p)m.push(new Po(s[p],i(p),n));m.push(new Po(d+u.text.slice(l.ch),f,n)),o(u,u.text.slice(0,a.ch)+s[0],i(0)),e.insert(a.line+1,m)}else if(1==s.length)o(u,u.text.slice(0,a.ch)+s[0]+c.text.slice(l.ch),i(0)),e.remove(a.line+1,h);else{o(u,u.text.slice(0,a.ch)+s[0],i(0)),o(c,d+c.text.slice(l.ch),f);for(var p=1,m=[];p<s.length-1;++p)m.push(new Po(s[p],i(p),n));h>1&&e.remove(a.line+1,h-1),e.insert(a.line+1,m)}qn(e,"change",e,t)}function mn(e){this.lines=e,this.parent=null;for(var t=0,r=0;t<e.length;++t)e[t].parent=this,r+=e[t].height;this.height=r}function gn(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}function vn(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;(!r||s)&&(t(l.doc,s),n(l.doc,e,s))}}}n(e,null,!0)}function yn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),r(e),e.options.lineWrapping||h(e),e.options.mode=t.modeOption,nt(e)}function bn(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(o>t){r=i;break}t-=o}return r.lines[t]}function wn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function xn(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function kn(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function Cn(e){if(null==e.parent)return null;for(var t=e.parent,r=ti(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function Ln(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(o>t){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;n<e.lines.length;++n){var a=e.lines[n],l=a.height;if(l>t)break;t-=l}return r+n}function Sn(e){e=Br(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var n=0;n<o.children.length;++n){var a=o.children[n];if(a==r)break;t+=a.height}return t}function Mn(e){var t=e.order;return null==t&&(t=e.order=ba(e.text)),t}function Tn(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function An(e,t){var r={from:V(t.from),to:go(t),text:wn(e,t.from,t.to)};return In(e,r,t.from.line,t.to.line+1),vn(e,function(e){In(e,r,t.from.line,t.to.line+1)},!0),r}function Nn(e){for(;e.length;){var t=ei(e);if(!t.ranges)break;e.pop()}}function Hn(e,t){return t?(Nn(e.done),ei(e.done)):e.done.length&&!ei(e.done).ranges?ei(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),ei(e.done)):void 0}function On(e,t,r,n){var i=e.history;i.undone.length=0;var o=+new Date,a;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>o-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(a=Hn(i,i.lastOp==n))){var l=ei(a.changes);0==no(t.from,t.to)&&0==no(t.from,l.to)?l.to=go(t):a.changes.push(An(e,t))}else{var s=ei(i.done);for(s&&s.ranges||Wn(e.sel,i.done),a={changes:[An(e,t)],generation:i.generation},i.done.push(a);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=o,i.lastOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||Yo(e,"historyAdded")}function zn(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function En(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||zn(e,o,ei(i.done),t))?i.done[i.done.length-1]=t:Wn(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastOp=r,n&&n.clearRedo!==!1&&Nn(i.undone)}function Wn(e,t){var r=ei(t);r&&r.ranges&&r.equals(e)||t.push(e)}function In(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function Dn(e){if(!e)return null;for(var t=0,r;t<e.length;++t)e[t].marker.explicitlyCleared?r||(r=e.slice(0,t)):r&&r.push(e[t]);return r?r.length?r:null:e}function Pn(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(Dn(r[n]));return i}function _n(e,t,r){for(var n=0,i=[];n<e.length;++n){var o=e[n];if(o.ranges)i.push(r?U.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];i.push({changes:l});for(var s=0;s<a.length;++s){var u=a[s],c;if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&ti(t,Number(c[1]))>-1&&(ei(l)[d]=u[d],delete u[d])}}}return i}function Fn(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Bn(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var l=0;l<o.ranges.length;l++)Fn(o.ranges[l].anchor,t,r,n),Fn(o.ranges[l].head,t,r,n)}else{for(var l=0;l<o.changes.length;++l){var s=o.changes[l];if(r<s.from.line)s.from=ro(s.from.line+n,s.from.ch),s.to=ro(s.to.line+n,s.to.ch);else if(t<=s.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function Rn(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;Bn(e.done,r,n,i),Bn(e.undone,r,n,i)}function jn(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Vn(e){return e.target||e.srcElement}function Gn(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Yi&&e.ctrlKey&&1==t&&(t=3),t}function qn(e,t){function r(e){return function(){e.apply(null,i)}}var n=e._handlers&&e._handlers[t];if(n){var i=Array.prototype.slice.call(arguments,2);Xo||(++Zo,Xo=[],setTimeout(Un,0));for(var o=0;o<n.length;++o)Xo.push(r(n[o]))}}function Un(){--Zo;var e=Xo;Xo=null;for(var t=0;t<e.length;++t)e[t]()}function Kn(e,t,r){return Yo(e,r||t.type,e,t),jn(t)||t.codemirrorIgnore}function $n(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==ti(r,t[n])&&r.push(t[n])}function Yn(e,t){var r=e._handlers&&e._handlers[t];return r&&r.length>0}function Xn(e){e.prototype.on=function(e,t){Ko(this,e,t)},e.prototype.off=function(e,t){$o(this,e,t)}}function Zn(){this.id=null}function Qn(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}function Jn(e){for(;ia.length<=e;)ia.push(ei(ia)+" ");return ia[e]}function ei(e){return e[e.length-1]}function ti(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function ri(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function ni(e,t){var r;if(Object.create)r=Object.create(e);else{var n=function(){};n.prototype=e,r=new n}return t&&ii(t,r),r}function ii(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||r===!1&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function oi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ai(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function li(e){return e.charCodeAt(0)>=768&&sa.test(e)}function si(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function ui(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function ci(e,t){return ui(e).appendChild(t)}function di(e,t){if(e.contains)return e.contains(t);for(;t=t.parentNode;)if(t==e)return!0}function fi(){return document.activeElement}function hi(e){return new RegExp("\\b"+e+"\\b\\s*")}function pi(e,t){var r=hi(t);r.test(e.className)&&(e.className=e.className.replace(r,""))}function mi(e,t){hi(t).test(e.className)||(e.className+=" "+t)}function gi(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!hi(r[n]).test(t)&&(t+=" "+r[n]);return t}function vi(e){if(null!=da)return da;var t=si("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return ci(e,t),t.offsetWidth&&(da=t.offsetHeight-t.clientHeight),da||0}function yi(e){if(null==fa){var t=si("span","​");ci(e,si("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(fa=t.offsetWidth<=1&&t.offsetHeight>2&&!Wi)}return fa?si("span","​"):si("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function bi(e){if(null!=ha)return ha;var t=ci(e,document.createTextNode("AخA")),r=ua(t,0,1).getBoundingClientRect();if(r.left==r.right)return!1;var n=ua(t,1,2).getBoundingClientRect();return ha=n.right-r.right<3}function wi(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function xi(e){return e.level%2?e.to:e.from}function ki(e){return e.level%2?e.from:e.to}function Ci(e){var t=Mn(e);return t?xi(t[0]):0}function Li(e){var t=Mn(e);return t?ki(ei(t)):e.text.length}function Si(e,t){var r=bn(e.doc,t),n=Br(r);n!=r&&(t=Cn(n));var i=Mn(n),o=i?i[0].level%2?Li(n):Ci(n):0;return ro(t,o)}function Mi(e,t){for(var r,n=bn(e.doc,t);r=_r(n);)n=r.find(1,!0).line,t=null;var i=Mn(n),o=i?i[0].level%2?Ci(n):Li(n):n.text.length;return ro(null==t?Cn(n):t,o)}function Ti(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function Ai(e,t){ya=null;for(var r=0,n;r<e.length;++r){var i=e[r];if(i.from<t&&i.to>t)return r;if(i.from==t||i.to==t){if(null!=n)return Ti(e,i.level,e[n].level)?(i.from!=i.to&&(ya=n),r):(i.from!=i.to&&(ya=r),n);n=r}}return n}function Ni(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&li(e.text.charAt(t)));return t}function Hi(e,t,r,n){var i=Mn(e);if(!i)return Oi(e,t,r,n);for(var o=Ai(i,t),a=i[o],l=Ni(e,t,a.level%2?-r:r,n);;){if(l>a.from&&l<a.to)return l;if(l==a.from||l==a.to)return Ai(i,l)==o?l:(a=i[o+=r],r>0==a.level%2?a.to:a.from);if(a=i[o+=r],!a)return null;l=r>0==a.level%2?Ni(e,a.to,-1,n):Ni(e,a.from,1,n)}}function Oi(e,t,r,n){var i=t+r;if(n)for(;i>0&&li(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var zi=/gecko\/\d/i.test(navigator.userAgent),Ei=/MSIE \d/.test(navigator.userAgent),Wi=Ei&&(null==document.documentMode||document.documentMode<8),Ii=Ei&&(null==document.documentMode||document.documentMode<9),Di=Ei&&(null==document.documentMode||document.documentMode<10),Pi=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),_i=Ei||Pi,Fi=/WebKit\//.test(navigator.userAgent),Bi=Fi&&/Qt\/\d+\.\d+/.test(navigator.userAgent),Ri=/Chrome\//.test(navigator.userAgent),ji=/Opera\//.test(navigator.userAgent),Vi=/Apple Computer/.test(navigator.vendor),Gi=/KHTML\//.test(navigator.userAgent),qi=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Ui=/PhantomJS/.test(navigator.userAgent),Ki=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),$i=Ki||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Yi=Ki||/Mac/.test(navigator.platform),Xi=/win/i.test(navigator.platform),Zi=ji&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Zi&&(Zi=Number(Zi[1])),Zi&&Zi>=15&&(ji=!1,Fi=!0);var Qi=Yi&&(Bi||ji&&(null==Zi||12.11>Zi)),Ji=zi||_i&&!Ii,eo=!1,to=!1,ro=e.Pos=function(e,t){return this instanceof ro?(this.line=e,void(this.ch=t)):new ro(e,t)},no=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch};U.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(0!=no(r.anchor,n.anchor)||0!=no(r.head,n.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new K(V(this.ranges[t].anchor),V(this.ranges[t].head));return new U(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(no(t,n.from())>=0&&no(e,n.to())<=0)return r}return-1}},K.prototype={from:function(){return q(this.anchor,this.head)},to:function(){return G(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var io={left:0,right:0,top:0,bottom:0},oo,ao=0,lo,so,uo=0,co=0,fo=null;_i?fo=-.53:zi?fo=15:Ri?fo=-.7:Vi&&(fo=-1/3);var ho,po=null,mo,go=e.changeEnd=function(e){return e.text?ro(e.from.line+e.text.length-1,ei(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),pt(this),dt(this)},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,yo.hasOwnProperty(e)&&Qe(this,yo[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](e)},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||"string"!=typeof t[r]&&t[r].name==e)return t.splice(r,1),!0},addOverlay:Je(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:t,opaque:r&&r.opaque}),this.state.modeGen++,nt(this)}),removeOverlay:Je(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void nt(this)}}),indentLine:Je(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),ee(this.doc,e)&&sr(this,e,t,r)}),indentSelection:Je(function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(sr(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&ar(this));else{var o=Math.max(r,i.from().line),a=i.to();r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=o;r>l;++l)sr(this,l,e)}}}),getTokenAt:function(e,t){var r=this.doc;e=Q(r,e);for(var n=ke(this,e.line,t),i=this.doc.mode,o=bn(r,e.line),a=new zo(o.text,this.options.tabSize);a.pos<e.ch&&!a.eol();){a.start=a.pos;var l=Jr(i,a,n)}return{start:a.start,end:a.pos,string:a.current(),type:l||null,state:n}},getTokenTypeAt:function(e){e=Q(this.doc,e);var t=rn(this,bn(this.doc,e.line)),r=0,n=(t.length-1)/2,i=e.ch,o;if(0==i)o=t[2];else for(;;){var a=r+n>>1;if((a?t[2*a-1]:0)>=i)n=a;else{if(!(t[2*a+1]<i)){o=t[2*a+2];break}r=a+1}}var l=o?o.indexOf("cm-overlay "):-1;return 0>l?o:0==l?null:o.slice(0,l-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!Lo.hasOwnProperty(t))return Lo;var n=Lo[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var a=n[i[t][o]];a&&r.push(a)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var o=0;o<n._global.length;o++){var l=n._global[o];l.pred(i,this)&&-1==ti(r,l.val)&&r.push(l.val)}return r},getStateAfter:function(e,t){var r=this.doc;return e=Z(r,null==e?r.first+r.size-1:e),ke(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?Q(this.doc,e):e?n.from():n.to(),je(this,r,t||"page")},charCoords:function(e,t){return Re(this,Q(this.doc,e),t||"page")},coordsChar:function(e,t){return e=Be(this,e,t||"page"),qe(this,e.left,e.top)},lineAtHeight:function(e,t){return e=Be(this,{top:e,left:0},t||"page").top,Ln(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r=!1,n=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>n&&(e=n,r=!0);var i=bn(this.doc,e);return Fe(this,i,{top:0,left:0},t||"page").top+(r?this.doc.height-Sn(i):0)},defaultTextHeight:function(){return Ke(this.display)},defaultCharWidth:function(){return $e(this.display)},setGutterMarker:Je(function(e,t,r){return ur(this,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&ai(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Je(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,it(t,n,"gutter"),ai(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),addLineClass:Je(function(e,t,r){return ur(this,e,"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"wrapClass";if(e[n]){if(new RegExp("(?:^|\\s)"+r+"(?:$|\\s)").test(e[n]))return!1;
4
- e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:Je(function(e,t,r){return ur(this,e,"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(new RegExp("(?:^|\\s+)"+r+"(?:$|\\s+)"));if(!o)return!1;var a=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:Je(function(e,t,r){return $r(this,e,t,r)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if("number"==typeof e){if(!ee(this.doc,e))return null;var t=e;if(e=bn(this.doc,e),!e)return null}else{var t=Cn(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=je(this,Q(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>u&&(l=u-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),r&&nr(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Je(It),triggerOnKeyPress:Je(_t),triggerOnKeyUp:Je(Pt),execCommand:function(e){return To.hasOwnProperty(e)?To[e](this):void 0},findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=Q(this.doc,e);t>o&&(a=dr(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:Je(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?dr(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},ra)}),deleteH:Je(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):cr(this,function(r){var i=dr(n,r.head,e,t,!1);return 0>e?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var a=0,l=Q(this.doc,e);t>a;++a){var s=je(this,l,"div");if(null==o?o=s.left:s.left=o,l=fr(this,s,i,r),l.hitSide)break}return l},moveV:Je(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var l=je(r,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=fr(r,l,e,t);return"page"==t&&a==n.sel.primary()&&or(r,null,Re(r,s,"div").top-l.top),s},ra),i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]}),toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?mi(this.display.cursorDiv,"CodeMirror-overwrite"):pi(this.display.cursorDiv,"CodeMirror-overwrite"),Yo(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return fi()==this.display.input},scrollTo:Je(function(e,t){(null!=e||null!=t)&&lr(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller,t=Qo;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-t,width:e.scrollWidth-t,clientHeight:e.clientHeight-t,clientWidth:e.clientWidth-t}},scrollIntoView:Je(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:ro(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)lr(this),this.curOp.scrollToPos=e;else{var r=ir(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(r.scrollLeft,r.scrollTop)}}),setSize:Je(function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&Ie(this),this.curOp.forceUpdate=!0,Yo(this,"refresh",this)}),operation:function(e){return Ze(this,e)},refresh:Je(function(){var e=this.display.cachedTextHeight;nt(this),this.curOp.forceUpdate=!0,De(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),d(this),(null==e||Math.abs(e-Ke(this.display))>.5)&&a(this),Yo(this,"refresh",this)}),swapDoc:Je(function(e){var t=this.doc;return t.cm=null,yn(this,e),De(this),ht(this),this.scrollTo(e.scrollLeft,e.scrollTop),qn(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Xn(e);var vo=e.defaults={},yo=e.optionHandlers={},bo=e.Init={toString:function(){return"CodeMirror.Init"}};pr("value","",function(e,t){e.setValue(t)},!0),pr("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),pr("indentUnit",2,r,!0),pr("indentWithTabs",!1),pr("smartIndent",!0),pr("tabSize",4,function(e){n(e),De(e),nt(e)},!0),pr("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(e,t){e.options.specialChars=new RegExp(t.source+(t.test(" ")?"":"| "),"g"),e.refresh()},!0),pr("specialCharPlaceholder",ln,function(e){e.refresh()},!0),pr("electricChars",!0),pr("rtlMoveVisually",!Xi),pr("wholeLineUpdateBefore",!0),pr("theme","default",function(e){s(e),u(e)},!0),pr("keyMap","default",l),pr("extraKeys",null),pr("lineWrapping",!1,i,!0),pr("gutters",[],function(e){p(e.options),u(e)},!0),pr("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?x(e.display)+"px":"0",e.refresh()},!0),pr("coverGutterNextToScrollbar",!1,g,!0),pr("lineNumbers",!1,function(e){p(e.options),u(e)},!0),pr("firstLineNumber",1,u,!0),pr("lineNumberFormatter",function(e){return e},u,!0),pr("showCursorWhenSelecting",!1,me,!0),pr("resetSelectionOnContextMenu",!0),pr("readOnly",!1,function(e,t){"nocursor"==t?(Bt(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||ht(e))}),pr("disableInput",!1,function(e,t){t||ht(e)},!0),pr("dragDrop",!0),pr("cursorBlinkRate",530),pr("cursorScrollMargin",0),pr("cursorHeight",1),pr("workTime",100),pr("workDelay",100),pr("flattenSpans",!0,n,!0),pr("addModeClass",!1,n,!0),pr("pollInterval",100),pr("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),pr("historyEventDelay",1250),pr("viewportMargin",10,function(e){e.refresh()},!0),pr("maxHighlightLength",1e4,n,!0),pr("moveInputWithCursor",!0,function(e,t){t||(e.display.inputDiv.style.top=e.display.inputDiv.style.left=0)}),pr("tabindex",null,function(e,t){e.display.input.tabIndex=t||""}),pr("autofocus",null);var wo=e.modes={},xo=e.mimeModes={};e.defineMode=function(t,r){if(e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2){r.dependencies=[];for(var n=2;n<arguments.length;++n)r.dependencies.push(arguments[n])}wo[t]=r},e.defineMIME=function(e,t){xo[e]=t},e.resolveMode=function(t){if("string"==typeof t&&xo.hasOwnProperty(t))t=xo[t];else if(t&&"string"==typeof t.name&&xo.hasOwnProperty(t.name)){var r=xo[t.name];"string"==typeof r&&(r={name:r}),t=ni(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=wo[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(ko.hasOwnProperty(r.name)){var o=ko[r.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var a in r.modeProps)i[a]=r.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var ko=e.modeExtensions={};e.extendMode=function(e,t){var r=ko.hasOwnProperty(e)?ko[e]:ko[e]={};ii(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){Ro.prototype[e]=t},e.defineOption=pr;var Co=[];e.defineInitHook=function(e){Co.push(e)};var Lo=e.helpers={};e.registerHelper=function(t,r,n){Lo.hasOwnProperty(t)||(Lo[t]=e[t]={_global:[]}),Lo[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),Lo[t]._global.push({pred:n,val:i})};var So=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},Mo=e.startState=function(e,t,r){return e.startState?e.startState(t,r):!0};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var To=e.commands={selectAll:function(e){e.setSelection(ro(e.firstLine(),0),ro(e.lastLine()),ea)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ea)},killLine:function(e){cr(e,function(t){if(t.empty()){var r=bn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:ro(t.head.line+1,0)}:{from:t.head,to:ro(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){cr(e,function(t){return{from:ro(t.from().line,0),to:Q(e.doc,ro(t.to().line+1,0))}})},delLineLeft:function(e){cr(e,function(e){return{from:ro(e.from().line,0),to:e.from()}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(ro(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(ro(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return Si(e,t.head.line)},ra)},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){var r=Si(e,t.head.line),n=e.getLineHandle(r.line),i=Mn(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.head.line==r.line&&t.head.ch<=o&&t.head.ch;return ro(r.line,a?0:o)}return r},ra)},goLineEnd:function(e){e.extendSelectionsBy(function(t){return Mi(e,t.head.line)},ra)},goLineRight:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},ra)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},ra)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),a=na(e.getLine(o.line),o.ch,n);t.push(new Array(n-a%n+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){Ze(e,function(){for(var t=e.listSelections(),r=0;r<t.length;r++){var n=t[r].head,i=bn(e.doc,n.line).text;n.ch>0&&n.ch<i.length-1&&e.replaceRange(i.charAt(n.ch)+i.charAt(n.ch-1),ro(n.line,n.ch-1),ro(n.line,n.ch+1))}})},newlineAndIndent:function(e){Ze(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange("\n",n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0),ar(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},Ao=e.keyMap={};Ao.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"},Ao.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","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"},Ao.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","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":"delLineLeft","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection",fallthrough:["basic","emacsy"]},Ao.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},Ao["default"]=Yi?Ao.macDefault:Ao.pcDefault;var No=e.lookupKey=function(e,t,r){function n(t){t=mr(t);var i=t[e];if(i===!1)return"stop";if(null!=i&&r(i))return!0;if(t.nofallthrough)return"stop";var o=t.fallthrough;if(null==o)return!1;if("[object Array]"!=Object.prototype.toString.call(o))return n(o);for(var a=0;a<o.length;++a){var l=n(o[a]);if(l)return l}return!1}for(var i=0;i<t.length;++i){var o=n(t[i]);if(o)return"stop"!=o}},Ho=e.isModifierKey=function(e){var t=va[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},Oo=e.keyName=function(e,t){if(ji&&34==e.keyCode&&e["char"])return!1;var r=va[e.keyCode];return null==r||e.altGraphKey?!1:(e.altKey&&(r="Alt-"+r),(Qi?e.metaKey:e.ctrlKey)&&(r="Ctrl-"+r),(Qi?e.ctrlKey:e.metaKey)&&(r="Cmd-"+r),!t&&e.shiftKey&&(r="Shift-"+r),r)};e.fromTextArea=function(t,r){function n(){t.value=u.getValue()}if(r||(r={}),r.value=t.value,!r.tabindex&&t.tabindex&&(r.tabindex=t.tabindex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus){var i=fi();r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Ko(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var o=t.form,a=o.submit;try{var l=o.submit=function(){n(),o.submit=a,o.submit(),o.submit=l}}catch(s){}}t.style.display="none";var u=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return u.save=n,u.getTextArea=function(){return t},u.toTextArea=function(){n(),t.parentNode.removeChild(u.getWrapperElement()),t.style.display="",t.form&&($o(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=a))},u};var zo=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};zo.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var r=t==e;else var r=t&&(e.test?e.test(t):e(t));return r?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=na(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?na(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return na(this.string,null,this.tabSize)-(this.lineStart?na(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var Eo=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e};Xn(Eo),Eo.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Ye(e),Yn(this,"clear")){var r=this.find();r&&qn(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=kr(a.markedSpans,this);e&&!this.collapsed?it(e,Cn(a),"text"):e&&(null!=l.to&&(i=Cn(a)),null!=l.from&&(n=Cn(a))),a.markedSpans=Cr(a.markedSpans,l),null==l.from&&this.collapsed&&!Gr(this.doc,a)&&e&&kn(a,Ke(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var s=Br(this.lines[o]),u=f(s);u>e.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&nt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&fe(e.doc)),e&&qn(e,"markerCleared",e,this),t&&Xe(e),this.parent&&this.parent.clear()}},Eo.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var o=this.lines[i],a=kr(o.markedSpans,this);if(null!=a.from&&(r=ro(t?o:Cn(o),a.from),-1==e))return r;if(null!=a.to&&(n=ro(t?o:Cn(o),a.to),1==e))return n}return r&&{from:r,to:n}},Eo.prototype.changed=function(){var e=this.find(-1,!0),t=this,r=this.doc.cm;e&&r&&Ze(r,function(){var n=e.line,i=Cn(e.line),o=He(r,i);if(o&&(We(o),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Gr(t.doc,n)&&null!=t.height){var a=t.height;t.height=null;var l=Kr(t)-a;l&&kn(n,n.height+l)}})},Eo.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=ti(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Eo.prototype.detachLine=function(e){if(this.lines.splice(ti(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var Wo=0,Io=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};Xn(Io),Io.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();qn(this,"clear")}},Io.prototype.find=function(e,t){return this.primary.find(e,t)};var Do=e.LineWidget=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.cm=e,this.node=t};Xn(Do),Do.prototype.clear=function(){var e=this.cm,t=this.line.widgets,r=this.line,n=Cn(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=Kr(this);Ze(e,function(){Ur(e,r,-o),it(e,n,"widget"),kn(r,Math.max(0,r.height-o))})}},Do.prototype.changed=function(){var e=this.height,t=this.cm,r=this.line;this.height=null;var n=Kr(this)-e;n&&Ze(t,function(){t.curOp.forceUpdate=!0,Ur(t,r,n),kn(r,r.height+n)})};var Po=e.Line=function(e,t,r){this.text=e,zr(this,t),this.height=r?r(this):1};Xn(Po),Po.prototype.lineNo=function(){return Cn(this)};var _o={},Fo={};mn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;n>r;++r){var i=this.lines[r];this.height-=i.height,Xr(i),qn(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;n>e;++e)if(r(this.lines[e]))return!0}},gn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(i>e){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof mn))){var l=[];this.collapse(l),this.children=[new mn(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),l=new mn(a);i.height-=l.height,this.children.splice(n+1,0,l),l.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new gn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=ti(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new gn(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>e){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var Bo=0,Ro=e.Doc=function(e,t,r){if(!(this instanceof Ro))return new Ro(e,t,r);null==r&&(r=0),gn.call(this,[new mn([new Po("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var n=ro(r,0);this.sel=X(n),this.history=new Tn(null),this.id=++Bo,this.modeOption=t,"string"==typeof e&&(e=pa(e)),pn(this,{from:n,to:n,text:e}),ue(this,X(n),ea)};Ro.prototype=ni(gn.prototype,{constructor:Ro,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=xn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:et(function(e){var t=ro(this.first,0),r=this.first+this.size-1;$t(this,{from:t,to:ro(r,bn(this,r).text.length),text:pa(e),origin:"setValue"},!0),ue(this,X(t))}),replaceRange:function(e,t,r,n){t=Q(this,t),r=r?Q(this,r):t,er(this,e,t,r,n)},getRange:function(e,t,r){var n=wn(this,Q(this,e),Q(this,t));return r===!1?n:n.join(r||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return ee(this,e)?bn(this,e):void 0},getLineNumber:function(e){return Cn(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=bn(this,e)),Br(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Q(this,e)},getCursor:function(e){var t=this.sel.primary(),r;return r=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||e===!1?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:et(function(e,t,r){ae(this,Q(this,"number"==typeof e?ro(e,t||0):e),null,r)}),setSelection:et(function(e,t,r){ae(this,Q(this,e),Q(this,t||e),r)}),extendSelection:et(function(e,t,r){ne(this,Q(this,e),t&&Q(this,t),r)}),extendSelections:et(function(e,t){ie(this,te(this,e,t))}),extendSelectionsBy:et(function(e,t){ie(this,ri(this.sel.ranges,e),t)}),setSelections:et(function(e,t,r){if(e.length){for(var n=0,i=[];n<e.length;n++)i[n]=new K(Q(this,e[n].anchor),Q(this,e[n].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),ue(this,Y(i,t),r)}}),addSelection:et(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new K(Q(this,e),Q(this,t||e))),ue(this,Y(n,n.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,n=0;n<t.length;n++){var i=wn(this,t[n].from(),t[n].to());r=r?r.concat(i):i}return e===!1?r:r.join(e||"\n")},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=wn(this,r[n].from(),r[n].to());e!==!1&&(i=i.join(e||"\n")),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:et(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];n[o]={from:a.from(),to:a.to(),text:pa(e[o]),origin:r}}for(var l=t&&"end"!=t&&Ut(this,n,t),o=n.length-1;o>=0;o--)$t(this,n[o]);l?se(this,l):this.cm&&ar(this.cm)}),undo:et(function(){Xt(this,"undo")}),redo:et(function(){Xt(this,"redo")}),undoSelection:et(function(){Xt(this,"undo",!0)}),redoSelection:et(function(){Xt(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new Tn(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:_n(this.history.done),undone:_n(this.history.undone)}},setHistory:function(e){var t=this.history=new Tn(this.history.maxGeneration);t.done=_n(e.done.slice(0),null,!0),t.undone=_n(e.undone.slice(0),null,!0)},markText:function(e,t,r){return gr(this,Q(this,e),Q(this,t),r,"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared};return e=Q(this,e),gr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=Q(this,e);var t=[],r=bn(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=Q(this,e),t=Q(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];i==e.line&&e.ch>s.to||null==s.from&&i!=e.line||i==t.line&&s.from>t.ch||r&&!r(s.marker)||n.push(s.marker.parent||s.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first;return this.iter(function(n){var i=n.text.length+1;return i>e?(t=e,!0):(e-=i,void++r)}),Q(this,ro(r,t))},indexFromPos:function(e){e=Q(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new Ro(xn(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Ro(xn(this,t,r),e.mode||this.modeOption,t);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],br(n,yr(this)),n},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=this.linked[r];if(n.doc==t){this.linked.splice(r,1),t.unlinkDoc(this),wr(yr(this));break}}if(t.history==this.history){var i=[t.id];vn(t,function(e){i.push(e.id)},!0),t.history=new Tn(null),t.history.done=_n(this.history.done,i),t.history.undone=_n(this.history.undone,i)}},iterLinkedDocs:function(e){vn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),Ro.prototype.eachLine=Ro.prototype.iter;var jo="iter insert remove copy getEditor".split(" ");for(var Vo in Ro.prototype)Ro.prototype.hasOwnProperty(Vo)&&ti(jo,Vo)<0&&(e.prototype[Vo]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ro.prototype[Vo]));Xn(Ro);var Go=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},qo=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},Uo=e.e_stop=function(e){Go(e),qo(e)},Ko=e.on=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={}),i=n[t]||(n[t]=[]);i.push(r)}},$o=e.off=function(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers&&e._handlers[t];if(!n)return;for(var i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}}},Yo=e.signal=function(e,t){var r=e._handlers&&e._handlers[t];if(r)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)},Xo,Zo=0,Qo=30,Jo=e.Pass={toString:function(){return"CodeMirror.Pass"}},ea={scroll:!1},ta={origin:"*mouse"},ra={origin:"+move"};Zn.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var na=e.countColumn=function(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=n||0,a=i||0;;){var l=e.indexOf(" ",o);if(0>l||l>=t)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}},ia=[""],oa=function(e){e.select()};Ki?oa=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:_i&&(oa=function(e){try{e.select()}catch(t){}}),[].indexOf&&(ti=function(e,t){return e.indexOf(t)}),[].map&&(ri=function(e,t){return e.map(t)});var aa=/[\u00df\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,la=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||aa.test(e))},sa=/[\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]/,ua;
5
  ua=document.createRange?function(e,t,r){var n=document.createRange();return n.setEnd(e,r),n.setStart(e,t),n}:function(e,t,r){var n=document.body.createTextRange();return n.moveToElementText(e.parentNode),n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n},Ei&&(fi=function(){try{return document.activeElement}catch(e){return document.body}});var ca=function(){if(Ii)return!1;var e=si("div");return"draggable"in e||"dragDrop"in e}(),da,fa,ha,pa=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ma=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},ga=function(){var e=si("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),va={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};e.keyNames=va,function(){for(var e=0;10>e;e++)va[e+48]=va[e+96]=String(e);for(var e=65;90>=e;e++)va[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)va[e+111]=va[e+63235]="F"+e}();var ya,ba=function(){function e(e){return 247>=e?r.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?n.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,u="L";return function(r){if(!i.test(r))return!1;for(var n=r.length,c=[],d=0,f;n>d;++d)c.push(f=e(r.charCodeAt(d)));for(var d=0,h=u;n>d;++d){var f=c[d];"m"==f?c[d]=h:h=f}for(var d=0,p=u;n>d;++d){var f=c[d];"1"==f&&"r"==p?c[d]="n":a.test(f)&&(p=f,"r"==f&&(c[d]="R"))}for(var d=1,h=c[0];n-1>d;++d){var f=c[d];"+"==f&&"1"==h&&"1"==c[d+1]?c[d]="1":","!=f||h!=c[d+1]||"1"!=h&&"n"!=h||(c[d]=h),h=f}for(var d=0;n>d;++d){var f=c[d];if(","==f)c[d]="N";else if("%"==f){for(var m=d+1;n>m&&"%"==c[m];++m);for(var g=d&&"!"==c[d-1]||n>m&&"1"==c[m]?"1":"N",v=d;m>v;++v)c[v]=g;d=m-1}}for(var d=0,p=u;n>d;++d){var f=c[d];"L"==p&&"1"==f?c[d]="L":a.test(f)&&(p=f)}for(var d=0;n>d;++d)if(o.test(c[d])){for(var m=d+1;n>m&&o.test(c[m]);++m);for(var y="L"==(d?c[d-1]:u),b="L"==(n>m?c[m]:u),g=y||b?"L":"R",v=d;m>v;++v)c[v]=g;d=m-1}for(var w=[],x,d=0;n>d;)if(l.test(c[d])){var k=d;for(++d;n>d&&l.test(c[d]);++d);w.push(new t(0,k,d))}else{var C=d,L=w.length;for(++d;n>d&&"L"!=c[d];++d);for(var v=C;d>v;)if(s.test(c[v])){v>C&&w.splice(L,0,new t(1,C,v));var S=v;for(++v;d>v&&s.test(c[v]);++v);w.splice(L,0,new t(2,S,v)),C=v}else++v;d>C&&w.splice(L,0,new t(1,C,d))}return 1==w[0].level&&(x=r.match(/^\s+/))&&(w[0].from=x[0].length,w.unshift(new t(0,0,x[0].length))),1==ei(w).level&&(x=r.match(/\s+$/))&&(ei(w).to-=x[0].length,w.push(new t(0,n-x[0].length,n))),w[0].level!=ei(w).level&&w.push(new t(w[0].level,n,n)),w}}();return e.version="4.1.0",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=!0;return t}function r(e,t){for(var r=!1,n;null!=(n=e.next());){if(r&&"/"==n){t.tokenize=null;break}r="*"==n}return["comment","comment"]}function n(e,t){return e.skipTo("-->")?(e.match("-->"),t.tokenize=null):e.skipToEnd(),["comment","comment"]}e.defineMode("css",function(t,r){function n(e,t){return C=t,e}function i(e,t){var r=e.next();if(p[r]){var i=p[r](e,t);if(i!==!1)return i}return"@"==r?(e.eatWhile(/[\w\\\-]/),n("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?n(null,"compare"):'"'==r||"'"==r?(t.tokenize=o(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),n("atom","hash")):"!"==r?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),n("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?n(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?n(null,r):"u"==r&&e.match("rl(")?(e.backUp(1),t.tokenize=a,n("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),n("number","unit")):e.match(/^[^-]+-/)?n("meta","meta"):void 0}function o(e){return function(t,r){for(var i=!1,o;null!=(o=t.next());){if(o==e&&!i){")"==e&&t.backUp(1);break}i=!i&&"\\"==o}return(o==e||!i&&")"!=e)&&(r.tokenize=null),n("string","string")}}function a(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=o(")"),n(null,"(")}function l(e,t,r){this.type=e,this.indent=t,this.prev=r}function s(e,t,r){return e.context=new l(r,t.indentation()+h,e.context),r}function u(e){return e.context=e.context.prev,e.context.type}function c(e,t,r){return S[r.context.type](e,t,r)}function d(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return c(e,t,r)}function f(e){var t=e.current().toLowerCase();L=w.hasOwnProperty(t)?"atom":b.hasOwnProperty(t)?"keyword":"variable"}r.propertyKeywords||(r=e.resolveMode("text/css"));var h=t.indentUnit,p=r.tokenHooks,m=r.mediaTypes||{},g=r.mediaFeatures||{},v=r.propertyKeywords||{},y=r.nonStandardPropertyKeywords||{},b=r.colorKeywords||{},w=r.valueKeywords||{},x=r.fontProperties||{},k=r.allowNested,C,L,S={};return S.top=function(e,t,r){if("{"==e)return s(r,t,"block");if("}"==e&&r.context.prev)return u(r);if("@media"==e)return s(r,t,"media");if("@font-face"==e)return"font_face_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return s(r,t,"at");if("hash"==e)L="builtin";else if("word"==e)L="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return s(r,t,"interpolation");if(":"==e)return"pseudo";if(k&&"("==e)return s(r,t,"params")}return r.context.type},S.block=function(e,t,r){if("word"==e){var n=t.current().toLowerCase();return v.hasOwnProperty(n)?(L="property","maybeprop"):y.hasOwnProperty(n)?(L="string-2","maybeprop"):k?(L=t.match(/^\s*:/,!1)?"property":"tag","block"):(L+=" error","maybeprop")}return"meta"==e?"block":k||"hash"!=e&&"qualifier"!=e?S.top(e,t,r):(L="error","block")},S.maybeprop=function(e,t,r){return":"==e?s(r,t,"prop"):c(e,t,r)},S.prop=function(e,t,r){if(";"==e)return u(r);if("{"==e&&k)return s(r,t,"propBlock");if("}"==e||"{"==e)return d(e,t,r);if("("==e)return s(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t.current())){if("word"==e)f(t);else if("interpolation"==e)return s(r,t,"interpolation")}else L+=" error";return"prop"},S.propBlock=function(e,t,r){return"}"==e?u(r):"word"==e?(L="property","maybeprop"):r.context.type},S.parens=function(e,t,r){return"{"==e||"}"==e?d(e,t,r):")"==e?u(r):"parens"},S.pseudo=function(e,t,r){return"word"==e?(L="variable-3",r.context.type):c(e,t,r)},S.media=function(e,t,r){if("("==e)return s(r,t,"media_parens");if("}"==e)return d(e,t,r);if("{"==e)return u(r)&&s(r,t,k?"block":"top");if("word"==e){var n=t.current().toLowerCase();L="only"==n||"not"==n||"and"==n?"keyword":m.hasOwnProperty(n)?"attribute":g.hasOwnProperty(n)?"property":"error"}return r.context.type},S.media_parens=function(e,t,r){return")"==e?u(r):"{"==e||"}"==e?d(e,t,r,2):S.media(e,t,r)},S.font_face_before=function(e,t,r){return"{"==e?s(r,t,"font_face"):c(e,t,r)},S.font_face=function(e,t,r){return"}"==e?u(r):"word"==e?(L=x.hasOwnProperty(t.current().toLowerCase())?"property":"error","maybeprop"):"font_face"},S.keyframes=function(e,t,r){return"word"==e?(L="variable","keyframes"):"{"==e?s(r,t,"top"):c(e,t,r)},S.at=function(e,t,r){return";"==e?u(r):"{"==e||"}"==e?d(e,t,r):("word"==e?L="tag":"hash"==e&&(L="builtin"),"at")},S.interpolation=function(e,t,r){return"}"==e?u(r):"{"==e||";"==e?d(e,t,r):("variable"!=e&&(L="error"),"interpolation")},S.params=function(e,t,r){return")"==e?u(r):"{"==e||"}"==e?d(e,t,r):("word"==e&&f(t),"params")},{startState:function(e){return{tokenize:null,state:"top",context:new l("top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||i)(e,t);return r&&"object"==typeof r&&(C=r[1],r=r[0]),L=r,t.state=S[t.state](C,e,t),L},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return"prop"==r.type&&"}"==n&&(r=r.prev),!r.prev||("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"font_face"!=r.type)&&(")"!=n||"parens"!=r.type&&"params"!=r.type&&"media_parens"!=r.type)&&("{"!=n||"at"!=r.type&&"media"!=r.type)||(i=r.indent-h,r=r.prev),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var i=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],o=t(i),a=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],l=t(a),s=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-inside","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],u=t(s),c=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],c=t(c),d=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],f=t(d),h=["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"],p=t(h),m=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],g=t(m),v=i.concat(a).concat(s).concat(c).concat(d).concat(h);e.registerHelper("hintWords","css",v),e.defineMIME("text/css",{mediaTypes:o,mediaFeatures:l,propertyKeywords:u,nonStandardPropertyKeywords:c,colorKeywords:f,valueKeywords:p,fontProperties:g,tokenHooks:{"<":function(e,t){return e.match("!--")?(t.tokenize=n,n(e,t)):!1},"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:o,mediaFeatures:l,propertyKeywords:u,nonStandardPropertyKeywords:c,colorKeywords:f,valueKeywords:p,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:o,mediaFeatures:l,propertyKeywords:u,nonStandardPropertyKeywords:c,colorKeywords:f,valueKeywords:p,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},"@":function(e){return e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("htmlmixed",function(t,r){function n(e,t){var r=t.htmlState.tagName,n=l.token(e,t.htmlState);if("script"==r&&/\btag\b/.test(n)&&">"==e.current()){var i=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);i=i?i[1]:"",i&&/[\"\']/.test(i.charAt(0))&&(i=i.slice(1,i.length-1));for(var c=0;c<u.length;++c){var d=u[c];if("string"==typeof d.matches?i==d.matches:d.matches.test(i)){d.mode&&(t.token=o,t.localMode=d.mode,t.localState=d.mode.startState&&d.mode.startState(l.indent(t.htmlState,"")));break}}}else"style"==r&&/\btag\b/.test(n)&&">"==e.current()&&(t.token=a,t.localMode=s,t.localState=s.startState(l.indent(t.htmlState,"")));return n}function i(e,t,r){var n=e.current(),i=n.search(t),o;return i>-1?e.backUp(n.length-i):(o=n.match(/<\/?$/))&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}function o(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=n,t.localState=t.localMode=null,n(e,t)):i(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function a(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=n,t.localState=t.localMode=null,n(e,t)):i(e,/<\/\s*style\s*>/,s.token(e,t.localState))}var l=e.getMode(t,{name:"xml",htmlMode:!0,multilineTagIndentFactor:r.multilineTagIndentFactor,multilineTagIndentPastTag:r.multilineTagIndentPastTag}),s=e.getMode(t,"css"),u=[],c=r&&r.scriptTypes;if(u.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:e.getMode(t,"javascript")}),c)for(var d=0;d<c.length;++d){var f=c[d];u.push({matches:f.matches,mode:f.mode&&e.getMode(t,f.mode)})}return u.push({matches:/./,mode:e.getMode(t,"text/plain")}),{startState:function(){var e=l.startState();return{token:n,localMode:null,localState:null,htmlState:e}},copyState:function(t){if(t.localState)var r=e.copyState(t.localMode,t.localState);return{token:t.token,localMode:t.localMode,localState:r,htmlState:e.copyState(l,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,r){return!t.localMode||/^\s*<\//.test(r)?l.indent(t.htmlState,r):t.localMode.indent?t.localMode.indent(t.localState,r):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||l}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("javascript",function(t,r){function n(e){for(var t=!1,r,n=!1;null!=(r=e.next());){if(!t){if("/"==r&&!n)return;"["==r?n=!0:n&&"]"==r&&(n=!1)}t=!t&&"\\"==r}}function i(e,t,r){return ke=e,Ce=r,t}function o(e,t){var r=e.next();if('"'==r||"'"==r)return t.tokenize=a(r),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return i("number","number");if("."==r&&e.match(".."))return i("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return i(r);if("="==r&&e.eat(">"))return i("=>","operator");if("0"==r&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),i("number","number");if(/\d/.test(r))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),i("number","number");if("/"==r)return e.eat("*")?(t.tokenize=l,l(e,t)):e.eat("/")?(e.skipToEnd(),i("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(n(e),e.eatWhile(/[gimy]/),i("regexp","string-2")):(e.eatWhile(we),i("operator","operator",e.current()));if("`"==r)return t.tokenize=s,s(e,t);if("#"==r)return e.skipToEnd(),i("error","error");if(we.test(r))return e.eatWhile(we),i("operator","operator",e.current());e.eatWhile(/[\w\$_]/);var o=e.current(),u=be.propertyIsEnumerable(o)&&be[o];return u&&"."!=t.lastType?i(u.type,u.style,o):i("variable","variable",o)}function a(e){return function(t,r){var n=!1,a;if(ge&&"@"==t.peek()&&t.match(xe))return r.tokenize=o,i("jsonld-keyword","meta");for(;null!=(a=t.next())&&(a!=e||n);)n=!n&&"\\"==a;return n||(r.tokenize=o),i("string","string")}}function l(e,t){for(var r=!1,n;n=e.next();){if("/"==n&&r){t.tokenize=o;break}r="*"==n}return i("comment","comment")}function s(e,t){for(var r=!1,n;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=o;break}r=!r&&"\\"==n}return i("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),l=Le.indexOf(a);if(l>=0&&3>l){if(!n){++o;break}if(0==--n)break}else if(l>=3&&6>l)++n;else if(/[$\w]/.test(a))i=!0;else if(i&&!n){++o;break}}i&&!n&&(t.fatArrowAt=o)}}function c(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function d(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function f(e,t,r,n,i){var o=e.cc;for(Me.state=e,Me.stream=i,Me.marked=null,Me.cc=o,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():ve?k:x;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Me.marked?Me.marked:"variable"==r&&d(e,n)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)Me.cc.push(arguments[e])}function p(){return h.apply(null,arguments),!0}function m(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var n=Me.state;if(n.context){if(Me.marked="def",t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;r.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function g(){Me.state.context={prev:Me.state.context,vars:Me.state.localVars},Me.state.localVars=Te}function v(){Me.state.localVars=Me.state.context.vars,Me.state.context=Me.state.context.prev}function y(e,t){var r=function(){var r=Me.state,n=r.indented;"stat"==r.lexical.type&&(n=r.lexical.indented),r.lexical=new c(n,Me.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function b(){var e=Me.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function w(e){function t(r){return r==e?p():";"==e?h():p(t)}return t}function x(e,t){return"var"==e?p(y("vardef",t.length),V,w(";"),b):"keyword a"==e?p(y("form"),k,x,b):"keyword b"==e?p(y("form"),x,b):"{"==e?p(y("}"),B,b):";"==e?p():"if"==e?("else"==Me.state.lexical.info&&Me.state.cc[Me.state.cc.length-1]==b&&Me.state.cc.pop()(),p(y("form"),k,x,b,Y)):"function"==e?p(te):"for"==e?p(y("form"),X,x,b):"variable"==e?p(y("stat"),E):"switch"==e?p(y("form"),k,y("}","switch"),w("{"),B,b,b):"case"==e?p(k,w(":")):"default"==e?p(w(":")):"catch"==e?p(y("form"),g,w("("),re,w(")"),x,b,v):"module"==e?p(y("form"),g,ae,v,b):"class"==e?p(y("form"),ne,oe,b):"export"==e?p(y("form"),le,b):"import"==e?p(y("form"),se,b):h(y("stat"),k,w(";"),b);
6
- }function k(e){return L(e,!1)}function C(e){return L(e,!0)}function L(e,t){if(Me.state.fatArrowAt==Me.stream.start){var r=t?z:O;if("("==e)return p(g,y(")"),_(G,")"),b,w("=>"),r,v);if("variable"==e)return h(g,G,w("=>"),r,v)}var n=t?A:T;return Se.hasOwnProperty(e)?p(n):"function"==e?p(te,n):"keyword c"==e?p(t?M:S):"("==e?p(y(")"),S,he,w(")"),b,n):"operator"==e||"spread"==e?p(t?C:k):"["==e?p(y("]"),de,b,n):"{"==e?F(I,"}",null,n):"quasi"==e?h(N,n):p()}function S(e){return e.match(/[;\}\)\],]/)?h():h(k)}function M(e){return e.match(/[;\}\)\],]/)?h():h(C)}function T(e,t){return","==e?p(k):A(e,t,!1)}function A(e,t,r){var n=0==r?T:A,i=0==r?k:C;return"=>"==t?p(g,r?z:O,v):"operator"==e?/\+\+|--/.test(t)?p(n):"?"==t?p(k,w(":"),i):p(i):"quasi"==e?h(N,n):";"!=e?"("==e?F(C,")","call",n):"."==e?p(W,n):"["==e?p(y("]"),S,w("]"),b,n):void 0:void 0}function N(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?p(N):p(k,H)}function H(e){return"}"==e?(Me.marked="string-2",Me.state.tokenize=s,p(N)):void 0}function O(e){return u(Me.stream,Me.state),h("{"==e?x:k)}function z(e){return u(Me.stream,Me.state),h("{"==e?x:C)}function E(e){return":"==e?p(b,x):h(T,w(";"),b)}function W(e){return"variable"==e?(Me.marked="property",p()):void 0}function I(e,t){if("variable"==e){if(Me.marked="property","get"==t||"set"==t)return p(D)}else if("number"==e||"string"==e)Me.marked=ge?"property":e+" property";else if("["==e)return p(k,w("]"),P);return Se.hasOwnProperty(e)?p(P):void 0}function D(e){return"variable"!=e?h(P):(Me.marked="property",p(te))}function P(e){return":"==e?p(C):"("==e?h(te):void 0}function _(e,t){function r(n){if(","==n){var i=Me.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),p(e,r)}return n==t?p():p(w(t))}return function(n){return n==t?p():h(e,r)}}function F(e,t,r){for(var n=3;n<arguments.length;n++)Me.cc.push(arguments[n]);return p(y(t,r),_(e,t),b)}function B(e){return"}"==e?p():h(x,B)}function R(e){return ye&&":"==e?p(j):void 0}function j(e){return"variable"==e?(Me.marked="variable-3",p()):void 0}function V(){return h(G,R,U,K)}function G(e,t){return"variable"==e?(m(t),p()):"["==e?F(G,"]"):"{"==e?F(q,"}"):void 0}function q(e,t){return"variable"!=e||Me.stream.match(/^\s*:/,!1)?("variable"==e&&(Me.marked="property"),p(w(":"),G,U)):(m(t),p(U))}function U(e,t){return"="==t?p(C):void 0}function K(e){return","==e?p(V):void 0}function Y(e,t){return"keyword b"==e&&"else"==t?p(y("form","else"),x,b):void 0}function X(e){return"("==e?p(y(")"),Z,w(")"),b):void 0}function Z(e){return"var"==e?p(V,w(";"),J):";"==e?p(J):"variable"==e?p(Q):h(k,w(";"),J)}function Q(e,t){return"in"==t||"of"==t?(Me.marked="keyword",p(k)):p(T,J)}function J(e,t){return";"==e?p(ee):"in"==t||"of"==t?(Me.marked="keyword",p(k)):h(k,w(";"),ee)}function ee(e){")"!=e&&p(k)}function te(e,t){return"*"==t?(Me.marked="keyword",p(te)):"variable"==e?(m(t),p(te)):"("==e?p(g,y(")"),_(re,")"),b,x,v):void 0}function re(e){return"spread"==e?p(re):h(G,R)}function ne(e,t){return"variable"==e?(m(t),p(ie)):void 0}function ie(e,t){return"extends"==t?p(k):void 0}function oe(e){return"{"==e?F(I,"}"):void 0}function ae(e,t){return"string"==e?p(x):"variable"==e?(m(t),p(ce)):void 0}function le(e,t){return"*"==t?(Me.marked="keyword",p(ce,w(";"))):"default"==t?(Me.marked="keyword",p(k,w(";"))):h(x)}function se(e){return"string"==e?p():h(ue,ce)}function ue(e,t){return"{"==e?F(ue,"}"):("variable"==e&&m(t),p())}function ce(e,t){return"from"==t?(Me.marked="keyword",p(k)):void 0}function de(e){return"]"==e?p():h(C,fe)}function fe(e){return"for"==e?h(he,w("]")):","==e?p(_(C,"]")):h(_(C,"]"))}function he(e){return"for"==e?p(X,he):"if"==e?p(k,he):void 0}var pe=t.indentUnit,me=r.statementIndent,ge=r.jsonld,ve=r.json||ge,ye=r.typescript,be=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},a={"if":e("if"),"while":t,"with":t,"else":r,"do":r,"try":r,"finally":r,"return":n,"break":n,"continue":n,"new":n,"delete":n,"throw":n,"debugger":n,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":e("this"),module:e("module"),"class":e("class"),"super":e("atom"),"yield":n,"export":e("export"),"import":e("import"),"extends":n};if(ye){var l={type:"variable",style:"variable-3"},s={"interface":e("interface"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),string:l,number:l,bool:l,any:l};for(var u in s)a[u]=s[u]}return a}(),we=/[+\-*&%=<>!?|~^]/,xe=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,ke,Ce,Le="([{}])",Se={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Me={state:null,column:null,marked:null,cc:null},Te={name:"this",next:{name:"arguments"}};return b.lex=!0,{startState:function(e){var t={tokenize:o,lastType:"sof",cc:[],lexical:new c((e||0)-pe,0,"block",!1),localVars:r.localVars,context:r.localVars&&{vars:r.localVars},indented:0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=l&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==ke?r:(t.lastType="operator"!=ke||"++"!=Ce&&"--"!=Ce?ke:"incdec",f(t,r,ke,Ce,e))},indent:function(t,n){if(t.tokenize==l)return e.Pass;if(t.tokenize!=o)return 0;var i=n&&n.charAt(0),a=t.lexical;if(!/^\s*else\b/.test(n))for(var s=t.cc.length-1;s>=0;--s){var u=t.cc[s];if(u==b)a=a.prev;else if(u!=Y)break}"stat"==a.type&&"}"==i&&(a=a.prev),me&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var c=a.type,d=i==c;return"vardef"==c?a.indented+("operator"==t.lastType||","==t.lastType?a.info+1:0):"form"==c&&"{"==i?a.indented:"form"==c?a.indented+pe:"stat"==c?a.indented+("operator"==t.lastType||","==t.lastType?me||pe:0):"switch"!=a.info||d||0==r.doubleIndentSwitch?a.align?a.column+(d?0:1):a.indented+(d?0:pe):a.indented+(/^(?:case|default)\b/.test(n)?pe:2*pe)},electricChars:":{}",blockCommentStart:ve?null:"/*",blockCommentEnd:ve?null:"*/",lineComment:ve?null:"//",fold:"brace",helperType:ve?"json":"javascript",jsonldMode:ge,jsonMode:ve}}),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("xml",function(t,r){function n(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();if("<"==n)return e.eat("!")?e.eat("[")?e.match("CDATA[")?r(a("atom","]]>")):null:e.match("--")?r(a("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(l(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=a("meta","?>"),"meta"):(S=e.eat("/")?"closeTag":"openTag",t.tokenize=i,"tag bracket");if("&"==n){var o;return o=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),o?"atom":"error"}return e.eatWhile(/[^&<]/),null}function i(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=n,S=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return S="equals",null;if("<"==r){t.tokenize=n,t.state=d,t.tagName=t.tagStart=null;var i=t.tokenize(e,t);return i?i+" error":"error"}return/[\'\"]/.test(r)?(t.tokenize=o(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function o(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=i;break}return"string"};return t.isInAttribute=!0,t}function a(e,t){return function(r,i){for(;!r.eol();){if(r.match(t)){i.tokenize=n;break}r.next()}return e}}function l(e){return function(t,r){for(var i;null!=(i=t.next());){if("<"==i)return r.tokenize=l(e+1),r.tokenize(t,r);if(">"==i){if(1==e){r.tokenize=n;break}return r.tokenize=l(e-1),r.tokenize(t,r)}}return"meta"}}function s(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(C.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function u(e){e.context&&(e.context=e.context.prev)}function c(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!C.contextGrabbers.hasOwnProperty(r)||!C.contextGrabbers[r].hasOwnProperty(t))return;u(e)}}function d(e,t,r){return"openTag"==e?(r.tagStart=t.column(),f):"closeTag"==e?h:d}function f(e,t,r){return"word"==e?(r.tagName=t.current(),M="tag",g):(M="error",f)}function h(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&C.implicitlyClosed.hasOwnProperty(r.context.tagName)&&u(r),r.context&&r.context.tagName==n?(M="tag",p):(M="tag error",m)}return M="error",m}function p(e,t,r){return"endTag"!=e?(M="error",p):(u(r),d)}function m(e,t,r){return M="error",p(e,t,r)}function g(e,t,r){if("word"==e)return M="attribute",v;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||C.autoSelfClosers.hasOwnProperty(n)?c(r,n):(c(r,n),r.context=new s(r,n,i==r.indented)),d}return M="error",g}function v(e,t,r){return"equals"==e?y:(C.allowMissing||(M="error"),g(e,t,r))}function y(e,t,r){return"string"==e?b:"word"==e&&C.allowUnquoted?(M="string",g):(M="error",g(e,t,r))}function b(e,t,r){return"string"==e?b:g(e,t,r)}var w=t.indentUnit,x=r.multilineTagIndentFactor||1,k=r.multilineTagIndentPastTag;null==k&&(k=!0);var C=r.htmlMode?{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},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}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},L=r.alignCDATA,S,M;return{startState:function(){return{tokenize:n,state:d,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;S=null;var r=t.tokenize(e,t);return(r||S)&&"comment"!=r&&(M=null,t.state=t.state(S||r,e,t),M&&(r="error"==M?r+" error":M)),r},indent:function(t,r,o){var a=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+w;if(a&&a.noIndent)return e.Pass;if(t.tokenize!=i&&t.tokenize!=n)return o?o.match(/^(\s*)/)[0].length:0;if(t.tagName)return k?t.tagStart+t.tagName.length+2:t.tagStart+w*x;if(L&&/<!\[CDATA\[/.test(r))return 0;var l=r&&/^<(\/)?([\w_:\.-]*)/.exec(r);if(l&&l[1])for(;a;){if(a.tagName==l[2]){a=a.prev;break}if(!C.implicitlyClosed.hasOwnProperty(a.tagName))break;a=a.prev}else if(l)for(;a;){var s=C.contextGrabbers[a.tagName];if(!s||!s.hasOwnProperty(l[2]))break;a=a.prev}for(;a&&!a.startOfLine;)a=a.prev;return a?a.indent+w:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:r.htmlMode?"html":"xml",helperType:r.htmlMode?"html":"xml"}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",o),e.removeLineClass(e.state.activeLines[t],"background",a)}function r(e,t){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function n(e,n){for(var i=[],l=0;l<n.length;l++){var s=e.getLineHandleVisualStart(n[l].head.line);i[i.length-1]!=s&&i.push(s)}r(e.state.activeLines,i)||e.operation(function(){t(e);for(var r=0;r<i.length;r++)e.addLineClass(i[r],"wrap",o),e.addLineClass(i[r],"background",a);e.state.activeLines=i})}function i(e,t){n(e,t.ranges)}var o="CodeMirror-activeline",a="CodeMirror-activeline-background";e.defineOption("styleActiveLine",!1,function(r,o,a){var l=a&&a!=e.Init;o&&!l?(r.state.activeLines=[],n(r,r.listSelections()),r.on("beforeSelectionChange",i)):!o&&l&&(r.off("beforeSelectionChange",i),t(r),delete r.state.activeLines)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n,i){var o=e.getLineHandle(t.line),s=t.ch-1,u=s>=0&&l[o.text.charAt(s)]||l[o.text.charAt(++s)];if(!u)return null;var c=">"==u.charAt(1)?1:-1;if(n&&c>0!=(s==t.ch))return null;var d=e.getTokenTypeAt(a(t.line,s+1)),f=r(e,a(t.line,s+(c>0?1:0)),c,d||null,i);return null==f?null:{from:a(t.line,s),to:f&&f.pos,match:f&&f.ch==u.charAt(0),forward:c>0}}function r(e,t,r,n,i){for(var o=i&&i.maxScanLineLength||1e4,s=i&&i.maxScanLines||1e3,u=[],c=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,d=r>0?Math.min(t.line+s,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-s),f=t.line;f!=d;f+=r){var h=e.getLine(f);if(h){var p=r>0?0:h.length-1,m=r>0?h.length:-1;if(!(h.length>o))for(f==t.line&&(p=t.ch-(0>r?1:0));p!=m;p+=r){var g=h.charAt(p);if(c.test(g)&&(void 0===n||e.getTokenTypeAt(a(f,p+1))==n)){var v=l[g];if(">"==v.charAt(1)==r>0)u.push(g);else{if(!u.length)return{pos:a(f,p),ch:g};u.pop()}}}}}return f-r==(r>0?e.lastLine():e.firstLine())?!1:null}function n(e,r,n){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,l=[],s=e.listSelections(),u=0;u<s.length;u++){var c=s[u].empty()&&t(e,s[u].head,!1,n);if(c&&e.getLine(c.from.line).length<=i){var d=c.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";l.push(e.markText(c.from,a(c.from.line,c.from.ch+1),{className:d})),c.to&&e.getLine(c.to.line).length<=i&&l.push(e.markText(c.to,a(c.to.line,c.to.ch+1),{className:d}))}}if(l.length){o&&e.state.focused&&e.display.input.focus();var f=function(){e.operation(function(){for(var e=0;e<l.length;e++)l[e].clear()})};if(!r)return f;setTimeout(f,800)}}function i(e){e.operation(function(){s&&(s(),s=null),s=n(e,!1,e.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),a=e.Pos,l={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},s=null;e.defineOption("matchBrackets",!1,function(t,r,n){n&&n!=e.Init&&t.off("cursorActivity",i),r&&(t.state.matchBrackets="object"==typeof r?r:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){n(this,!0)}),e.defineExtension("findMatchingBracket",function(e,r,n){return t(this,e,r,n)}),e.defineExtension("scanForBracket",function(e,t,n,i){return r(this,e,t,n,i)})}),window.onload=heshPlugin;
1
+ function heshPlugin(){var e=null,t=0,r=0,n=document.getElementById("content"),i=null!==document.getElementById("post_ID")?document.getElementById("post_ID").value:0,o=document.getElementById("content-html"),a=document.getElementById("content-tmce"),l=-1!==document.cookie.indexOf("hesh_plugin_theme=mbo")?"mbo":"default",s=-1!==document.cookie.indexOf("editor%3Dtinymce")?!0:!1,u=null!==document.getElementById("content-tmce")?!0:!1,c=document.getElementById("ed_toolbar"),d=document.getElementById("wp-content-editor-container"),f="heshFullscreen",h=document.getElementById("publish"),p={mode:"text/html",tabMode:"indent",theme:l,lineNumbers:!0,matchBrackets:!0,indentUnit:4,indentWithTabs:!0,enterMode:"keep",lineWrapping:!0,autofocus:!0,styleActiveLine:!0,electricChars:!1,extraKeys:{F11:function(){A()},Esc:function(){A()},"Ctrl-S":function(){h.click()},"Cmd-S":function(){h.click()}}},m=function(e){var t="; "+document.cookie,r=t.split("; "+e+"=");return 2==r.length?r.pop().split(";").shift():void 0},g=m("hesh_plugin_font_size")||"12",v=function(){C(),e=CodeMirror.fromTextArea(n,p),e.on("change",function(){e.save(),clearTimeout(x),x=setTimeout(k,3e3)}),e.on("cursorActivity",function(){var t=e.getCursor();document.cookie="hesh_plugin_pos="+i+","+t.line+","+t.ch});var r=(m("hesh_plugin_pos")||"0,0,0").split(",");i===r[0]&&e.setCursor(parseFloat(r[1]),parseFloat(r[2])),T(),E(),t=1,y(),window.addEventListener("resize",w),window.setTimeout(k,3e3)},y=function(){document.querySelector(".CodeMirror").style.marginTop=c.clientHeight+"px"},b,w=function(){clearTimeout(b),b=setTimeout(y,250)},x,k=function(){null!=document.querySelector(".CodeMirror")&&(document.querySelector("textarea.wp-editor-area").style.height=document.querySelector(".CodeMirror").clientHeight+"px")},C=function(){if(!r){var e={more:["<!--more-->",""],comment:["<!-- "," -->"],code:["<code>","</code>"],li:["<li>","</li>"],ol:["<ol>","</ol>"],ul:["<ul>","</ul>"],img:['<img src="$" alt="','">',"Enter the URL of the image"],ins:["<ins>","</ins>"],del:["<del>","</del>"],link:['<a href="$">',"</a>","Enter the destination URL"],blockquote:["\r<blockquote>","</blockquote>\r"],h3:["<h3>","</h3>"],h2:["<h2>","</h2>"],h1:["<h1>","</h1>"],p:["<p>","</p>"],i:["<em>","</em>"],b:["<strong>","</strong>"]};for(var t in e){var n=e[t],i=n[2]?'data-prompt="'+n[2]+'"':"";c.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_content_'+t+"\" data-start='"+n[0]+"' data-end='"+n[1]+"' "+i+' class="ed_button button cm_ed_button" value="'+t+'">'),document.getElementById("cm_content_"+t).onclick=L}H(),z(),N(),r=1}},L=function(){var t=e.getCursor("start"),r=this.getAttribute("data-start"),n=this.getAttribute("data-end"),i=this.getAttribute("data-prompt")||null,o=e.getSelection();"cm_content_link"===this.id&&wpLink?(wpLink.open(),document.getElementById("wp-link-submit").onclick=function(){var n=wpLink.getAttrs();r='<a href="'+n.href+'" title="'+n.title+'" target="'+n.target+'">',e.replaceSelection(r+o+"</a>"),wpLink.close(),e.setCursor(t.line,t.ch+r.length),e.focus()}):(i&&(r=r.replace("$",prompt(i,""))),e.replaceSelection(r+o+n),e.setCursor(t.line,t.ch+r.length),e.focus())},S=function(){t&&(switchEditors.switchto&&switchEditors.switchto(this),e.toTextArea(),o.onclick=M,t=0,window.removeEventListener("resize",w))},M=function(){t||(switchEditors.switchto&&switchEditors.switchto(this),window.setTimeout(v,300),a.onclick=S)},T=function(){var e=document.querySelector(".CodeMirror"),t=document.createElement("div"),r=document.getElementById("wp-content-wrap"),n=e.getBoundingClientRect().top,i=function(t){t=t||window.event;var r=(t.pageY||t.clientY+document.body.scrollTop+document.documentElement.scrollTop)-n;e.style.height=(r>10?r:10)+"px",window.getSelection().removeAllRanges()};t.className="content-resize-handle",r.appendChild(t),t.onmousedown=function(){document.onmousemove=i},document.onmouseup=function(){document.onmousemove=null}},A=function(){d.className=-1===d.className.indexOf(f)?d.className+" "+f:d.className.replace(f,"");var t=document.getElementById("cm_content_fullscreen");t.value="fullscreen"===t.value?"exit fullscreen":"fullscreen",e.focus()},N=function(){c.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_content_fullscreen" class="ed_button button" title="Toggle fullscreen mode" value="fullscreen">'),document.getElementById("cm_content_fullscreen").onclick=A},H=function(){var t=function(){return"mbo"===l?"light":"dark"};c.insertAdjacentHTML("afterbegin",'<input type="button" id="cm_select_theme" class="ed_button button" title="Change editor colour scheme" value="'+t()+'">'),document.getElementById("cm_select_theme").onclick=function(){l="mbo"===l?"default":"mbo",e.setOption("theme",l),document.cookie="hesh_plugin_theme="+l,this.value=t()}},O=function(){var e=document.getElementById("hesh-style"),t=".CodeMirror {font-size: "+g+"px !important;}";e?e.innerHTML=t:document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend",'<style id="hesh-style">'+t+"</style>")},z=function(){c.insertAdjacentHTML("afterbegin",'<select id="cm_font_size" class="button"><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="16">16</option><option value="18">18</option><option value="20">20</option><option value="22">22</option></select>');var t=document.getElementById("cm_font_size");O(),t.value=g,t.onchange=function(){g=this.value,O(),e.toTextArea(),v(),e.focus(),document.cookie="hesh_plugin_font_size="+g}},E=function(){window.send_to_editor_wp||(window.send_to_editor_wp=send_to_editor,send_to_editor=function(r){t&&"content"===wpActiveEditor?(e.replaceSelection(r),e.save()):window.send_to_editor_wp(r)})};s&&u?o.onclick=M:(v(),u?a.onclick=S:document.body.className+=" visual-editor-is-disabled")}!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);this.CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n||{},ii(vo,n,!1),p(n);var i=n.value;"string"==typeof i&&(i=new Ro(i,n.mode)),this.doc=i;var o=this.display=new t(r,i);o.wrapper.CodeMirror=this,c(this),s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!$i&&pt(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Zn},Ei&&setTimeout(oi(ht,this,!0),20),vt(this);var a=this;Ze(this,function(){a.curOp.forceUpdate=!0,yn(a,i),n.autofocus&&!$i||fi()==o.input?setTimeout(oi(Ft,a),20):Bt(a);for(var e in yo)yo.hasOwnProperty(e)&&yo[e](a,n[e],bo);for(var t=0;t<Co.length;++t)Co[t](a)})}function t(e,t){var r=this,n=r.input=si("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");Fi?n.style.width="1000px":n.setAttribute("wrap","off"),Ki&&(n.style.border="1px solid black"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck","false"),r.inputDiv=si("div",[n],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),r.scrollbarH=si("div",[si("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),r.scrollbarV=si("div",[si("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r.scrollbarFiller=si("div",null,"CodeMirror-scrollbar-filler"),r.gutterFiller=si("div",null,"CodeMirror-gutter-filler"),r.lineDiv=si("div",null,"CodeMirror-code"),r.selectionDiv=si("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=si("div",null,"CodeMirror-cursors"),r.measure=si("div",null,"CodeMirror-measure"),r.lineMeasure=si("div",null,"CodeMirror-measure"),r.lineSpace=si("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none"),r.mover=si("div",[si("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=si("div",[r.mover],"CodeMirror-sizer"),r.heightForcer=si("div",null,null,"position: absolute; height: "+Qo+"px; width: 1px;"),r.gutters=si("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=si("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=si("div",[r.inputDiv,r.scrollbarH,r.scrollbarV,r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),Wi&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),Ki&&(n.style.width="0px"),Fi||(r.scroller.draggable=!0),qi&&(r.inputDiv.style.height="1px",r.inputDiv.style.position="absolute"),Wi&&(r.scrollbarH.style.minHeight=r.scrollbarV.style.minWidth="18px"),e.appendChild?e.appendChild(r.wrapper):e(r.wrapper),r.viewFrom=r.viewTo=t.first,r.view=[],r.externalMeasured=null,r.viewOffset=0,r.lastSizeC=0,r.updateLineNumbers=null,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.prevInput="",r.alignWidgets=!1,r.pollingFast=!1,r.poll=new Zn,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.inaccurateSelection=!1,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,be(e,100),e.state.modeGen++,e.curOp&&nt(e)}function i(e){e.options.lineWrapping?(mi(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth=""):(pi(e.display.wrapper,"CodeMirror-wrap"),h(e)),a(e),nt(e),De(e),setTimeout(function(){g(e)},100)}function o(e){var t=Ke(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/$e(e.display)-3);return function(i){if(qr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function a(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&kn(e,t)})}function l(e){var t=Ao[e.options.keyMap],r=t.style;e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(r?" cm-keymap-"+r:"")}function s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),De(e)}function u(e){c(e),nt(e),setTimeout(function(){y(e)},20)}function c(e){var t=e.display.gutters,r=e.options.gutters;ui(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(si("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",d(e)}function d(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px",e.display.scrollbarH.style.left=e.options.fixedGutter?t+"px":0}function f(e){if(0==e.height)return 0;for(var t=e.text.length,r,n=e;r=Pr(n);){var i=r.find(0,!0);n=i.from.line,t+=i.from.ch-i.to.ch}for(n=e;r=_r(n);){var i=r.find(0,!0);t-=n.text.length-i.from.ch,n=i.to.line,t+=n.text.length-i.to.ch}return t}function h(e){var t=e.display,r=e.doc;t.maxLine=bn(r,r.first),t.maxLineLength=f(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=f(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function p(e){var t=ti(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function m(e){var t=e.display.scroller;return{clientHeight:t.clientHeight,barHeight:e.display.scrollbarV.clientHeight,scrollWidth:t.scrollWidth,clientWidth:t.clientWidth,barWidth:e.display.scrollbarH.clientWidth,docHeight:Math.round(e.doc.height+Le(e.display))}}function g(e,t){t||(t=m(e));var r=e.display,n=t.docHeight+Qo,i=t.scrollWidth>t.clientWidth,o=n>t.clientHeight;if(o?(r.scrollbarV.style.display="block",r.scrollbarV.style.bottom=i?vi(r.measure)+"px":"0",r.scrollbarV.firstChild.style.height=Math.max(0,n-t.clientHeight+(t.barHeight||r.scrollbarV.clientHeight))+"px"):(r.scrollbarV.style.display="",r.scrollbarV.firstChild.style.height="0"),i?(r.scrollbarH.style.display="block",r.scrollbarH.style.right=o?vi(r.measure)+"px":"0",r.scrollbarH.firstChild.style.width=t.scrollWidth-t.clientWidth+(t.barWidth||r.scrollbarH.clientWidth)+"px"):(r.scrollbarH.style.display="",r.scrollbarH.firstChild.style.width="0"),i&&o?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=r.scrollbarFiller.style.width=vi(r.measure)+"px"):r.scrollbarFiller.style.display="",i&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=vi(r.measure)+"px",r.gutterFiller.style.width=r.gutters.offsetWidth+"px"):r.gutterFiller.style.display="",!e.state.checkedOverlayScrollbar&&t.clientHeight>0){if(0===vi(r.measure)){var a=Yi&&!Gi?"12px":"18px";r.scrollbarV.style.minWidth=r.scrollbarH.style.minHeight=a;var l=function(t){Vn(t)!=r.scrollbarV&&Vn(t)!=r.scrollbarH&&Qe(e,wt)(t)};Ko(r.scrollbarV,"mousedown",l),Ko(r.scrollbarH,"mousedown",l)}e.state.checkedOverlayScrollbar=!0}}function v(e,t,r){var n=r&&null!=r.top?r.top:e.scroller.scrollTop;n=Math.floor(n-Ce(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=Ln(t,n),a=Ln(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;if(o>l)return{from:l,to:Ln(t,Sn(bn(t,l))+e.wrapper.clientHeight)};if(Math.min(s,t.lastLine())>=a)return{from:Ln(t,Sn(bn(t,s))-e.wrapper.clientHeight),to:s}}return{from:o,to:a}}function y(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=x(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&r[a].gutter&&(r[a].gutter.style.left=o);var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function b(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=w(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(si("div",[si("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a),n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",d(e),!0}return!1}function w(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function x(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function k(e,t,r){for(var n=e.display.viewFrom,i=e.display.viewTo,o,a=v(e.display,e.doc,t),l=!0;;l=!1){var s=e.display.scroller.clientWidth;if(!C(e,a,r))break;o=!0,e.display.maxLineChanged&&!e.options.lineWrapping&&L(e);var u=m(e);if(me(e),S(e,u),g(e,u),Fi&&e.options.lineWrapping&&M(e,u),l&&e.options.lineWrapping&&s!=e.display.scroller.clientWidth)r=!0;else if(r=!1,t&&null!=t.top&&(t={top:Math.min(u.docHeight-Qo-u.clientHeight,t.top)}),a=v(e.display,e.doc,t),a.from>=e.display.viewFrom&&a.to<=e.display.viewTo)break}return e.display.updateLineNumbers=null,o&&(Gn(e,"update",e),(e.display.viewFrom!=n||e.display.viewTo!=i)&&Gn(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo)),o}function C(e,t,r){var n=e.display,i=e.doc;if(!n.wrapper.offsetWidth)return void ot(e);if(!(!r&&t.from>=n.viewFrom&&t.to<=n.viewTo&&0==ut(e))){b(e)&&ot(e);var o=N(e),a=i.first+i.size,l=Math.max(t.from-e.options.viewportMargin,i.first),s=Math.min(a,t.to+e.options.viewportMargin);n.viewFrom<l&&l-n.viewFrom<20&&(l=Math.max(i.first,n.viewFrom)),n.viewTo>s&&n.viewTo-s<20&&(s=Math.min(a,n.viewTo)),to&&(l=jr(e.doc,l),s=Vr(e.doc,s));var u=l!=n.viewFrom||s!=n.viewTo||n.lastSizeC!=n.wrapper.clientHeight;st(e,l,s),n.viewOffset=Sn(bn(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var c=ut(e);if(u||0!=c||r){var d=fi();return c>4&&(n.lineDiv.style.display="none"),H(e,n.updateLineNumbers,o),c>4&&(n.lineDiv.style.display=""),d&&fi()!=d&&d.offsetHeight&&d.focus(),ui(n.cursorDiv),ui(n.selectionDiv),u&&(n.lastSizeC=n.wrapper.clientHeight,be(e,400)),T(e),!0}}}function L(e){var t=e.display,r=Ne(e,t.maxLine,t.maxLine.text.length).left;t.maxLineChanged=!1;var n=Math.max(0,r+3),i=Math.max(0,t.sizer.offsetLeft+n+Qo-t.scroller.clientWidth);t.sizer.style.minWidth=n+"px",i<e.doc.scrollLeft&&Nt(e,Math.min(t.scroller.scrollLeft,i),!0)}function S(e,t){e.display.sizer.style.minHeight=e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=Math.max(t.docHeight,t.clientHeight-Qo)+"px"}function M(e,t){e.display.sizer.offsetWidth+e.display.gutters.offsetWidth<e.display.scroller.clientWidth-1&&(e.display.sizer.style.minHeight=e.display.heightForcer.style.top="0px",e.display.gutters.style.height=t.docHeight+"px")}function T(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o;if(!i.hidden){if(Wi){var a=i.node.offsetTop+i.node.offsetHeight;o=a-r,r=a}else{var l=i.node.getBoundingClientRect();o=l.bottom-l.top}var s=i.line.height-o;if(2>o&&(o=Ke(t)),(s>.001||-.001>s)&&(kn(i.line,o),A(i.line),i.rest))for(var u=0;u<i.rest.length;u++)A(i.rest[u])}}}function A(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function N(e){for(var t=e.display,r={},n={},i=t.gutters.firstChild,o=0;i;i=i.nextSibling,++o)r[e.options.gutters[o]]=i.offsetLeft,n[e.options.gutters[o]]=i.offsetWidth;return{fixedPos:x(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function H(e,t,r){function n(t){var r=t.nextSibling;return Fi&&Yi&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var i=e.display,o=e.options.lineNumbers,a=i.lineDiv,l=a.firstChild,s=i.view,u=i.viewFrom,c=0;c<s.length;c++){var d=s[c];if(d.hidden);else if(d.node){for(;l!=d.node;)l=n(l);var f=o&&null!=t&&u>=t&&d.lineNumber;d.changes&&(ti(d.changes,"gutter")>-1&&(f=!1),O(e,d,u,r)),f&&(ui(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(w(e.options,u)))),l=d.node.nextSibling}else{var h=F(e,d,u,r);a.insertBefore(h,l)}u+=d.size}for(;l;)l=n(l)}function O(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?I(e,t):"gutter"==o?P(e,t,r,n):"class"==o?D(t):"widget"==o&&_(t,n)}t.changes=null}function z(e){return e.node==e.text&&(e.node=si("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),Wi&&(e.node.style.zIndex=2)),e.node}function E(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=z(e);e.background=r.insertBefore(si("div",null,t),r.firstChild)}}function W(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):an(e,t)}function I(e,t){var r=t.text.className,n=W(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,D(t)):r&&(t.text.className=r)}function D(e){E(e),e.line.wrapClass?z(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function P(e,t,r,n){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=z(t),a=t.gutter=o.insertBefore(si("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px"),t.text);if(!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(si("div",w(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var l=0;l<e.options.gutters.length;++l){var s=e.options.gutters[l],u=i.hasOwnProperty(s)&&i[s];u&&a.appendChild(si("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[s]+"px; width: "+n.gutterWidth[s]+"px"))}}}function _(e,t){e.alignable&&(e.alignable=null);for(var r=e.node.firstChild,n;r;r=n){var n=r.nextSibling;"CodeMirror-linewidget"==r.className&&e.node.removeChild(r)}B(e,t)}function F(e,t,r,n){var i=W(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),D(t),P(e,t,r,n),B(t,n),t.node}function B(e,t){if(R(e.line,e,t,!0),e.rest)for(var r=0;r<e.rest.length;r++)R(e.rest[r],e,t,!1)}function R(e,t,r,n){if(e.widgets)for(var i=z(t),o=0,a=e.widgets;o<a.length;++o){var l=a[o],s=si("div",[l.node],"CodeMirror-linewidget");l.handleMouseEvents||(s.ignoreEvents=!0),j(l,s,t,r),n&&l.above?i.insertBefore(s,t.gutter||t.text):i.appendChild(s),Gn(l,"redraw")}}function j(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function V(e){return ro(e.line,e.ch)}function q(e,t){return no(e,t)<0?t:e}function G(e,t){return no(e,t)<0?e:t}function U(e,t){this.ranges=e,this.primIndex=t}function K(e,t){this.anchor=e,this.head=t}function Y(e,t){var r=e[t];e.sort(function(e,t){return no(e.from(),t.from())}),t=ti(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(no(o.to(),i.from())>=0){var a=G(o.from(),i.from()),l=q(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;t>=n&&--t,e.splice(--n,2,new K(s?l:a,s?a:l))}}return new U(e,t)}function X(e,t){return new U([new K(e,t||e)],0)}function Z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Q(e,t){if(t.line<e.first)return ro(e.first,0);var r=e.first+e.size-1;return t.line>r?ro(r,bn(e,r).text.length):J(t,bn(e,t.line).text.length)}function J(e,t){var r=e.ch;return null==r||r>t?ro(e.line,t):0>r?ro(e.line,0):e}function ee(e,t){return t>=e.first&&t<e.first+e.size}function te(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=Q(e,t[n]);return r}function re(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=no(r,i)<0;o!=no(n,i)<0?(i=r,r=n):o!=no(r,n)<0&&(r=n)}return new K(i,r)}return new K(n||r,r)}function ne(e,t,r,n){ue(e,new U([re(e,e.sel.primary(),t,r)],0),n)}function ie(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=re(e,e.sel.ranges[i],t[i],null);var o=Y(n,e.sel.primIndex);ue(e,o,r)}function oe(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,ue(e,Y(i,e.sel.primIndex),n)}function ae(e,t,r,n){ue(e,X(t,r),n)}function le(e,t){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new K(Q(e,t[r].anchor),Q(e,t[r].head))}};return Yo(e,"beforeSelectionChange",e,r),e.cm&&Yo(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Y(r.ranges,r.ranges.length-1):t}function se(e,t,r){var n=e.history.done,i=ei(n);i&&i.ranges?(n[n.length-1]=t,ce(e,t,r)):ue(e,t,r)}function ue(e,t,r){ce(e,t,r),En(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function ce(e,t,r){(Yn(e,"beforeSelectionChange")||e.cm&&Yn(e.cm,"beforeSelectionChange"))&&(t=le(e,t));var n=no(t.primary().head,e.sel.primary().head)<0?-1:1;de(e,he(e,t,n,!0)),r&&r.scroll===!1||!e.cm||ar(e.cm)}function de(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,$n(e.cm)),Gn(e,"cursorActivity",e))}function fe(e){de(e,he(e,e.sel,null,!1),ea)}function he(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=pe(e,a.anchor,r,n),s=pe(e,a.head,r,n);(i||l!=a.anchor||s!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new K(l,s))}return i?Y(i,t.primIndex):t}function pe(e,t,r,n){var i=!1,o=t,a=r||1;e.cantEdit=!1;e:for(;;){var l=bn(e,o.line);if(l.markedSpans)for(var s=0;s<l.markedSpans.length;++s){var u=l.markedSpans[s],c=u.marker;if((null==u.from||(c.inclusiveLeft?u.from<=o.ch:u.from<o.ch))&&(null==u.to||(c.inclusiveRight?u.to>=o.ch:u.to>o.ch))){if(n&&(Yo(c,"beforeCursorEnter"),c.explicitlyCleared)){if(l.markedSpans){--s;continue}break}if(!c.atomic)continue;var d=c.find(0>a?-1:1);if(0==no(d,o)&&(d.ch+=a,d.ch<0?d=d.line>e.first?Q(e,ro(d.line-1)):null:d.ch>l.text.length&&(d=d.line<e.first+e.size-1?ro(d.line+1,0):null),!d)){if(i)return n?(e.cantEdit=!0,ro(e.first,0)):pe(e,t,r,!0);i=!0,d=t,a=-a}o=d;continue e}}return o}}function me(e){for(var t=e.display,r=e.doc,n=document.createDocumentFragment(),i=document.createDocumentFragment(),o=0;o<r.sel.ranges.length;o++){var a=r.sel.ranges[o],l=a.empty();(l||e.options.showCursorWhenSelecting)&&ge(e,a,n),l||ve(e,a,i)}if(e.options.moveInputWithCursor){var s=je(e,r.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),c=t.lineDiv.getBoundingClientRect(),d=Math.max(0,Math.min(t.wrapper.clientHeight-10,s.top+c.top-u.top)),f=Math.max(0,Math.min(t.wrapper.clientWidth-10,s.left+c.left-u.left));t.inputDiv.style.top=d+"px",t.inputDiv.style.left=f+"px"}ci(t.cursorDiv,n),ci(t.selectionDiv,i)}function ge(e,t,r){var n=je(e,t.head,"div"),i=r.appendChild(si("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(si("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function ve(e,t,r){function n(e,t,r,n){0>t&&(t=0),t=Math.round(t),n=Math.round(n),l.appendChild(si("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?c-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return Re(e,ro(t,r),"div",l,n)}var l=bn(a,t),s=l.text.length,d,f;return wi(Mn(l),r||0,null==i?s:i,function(e,t,a){var l=o(e,"left"),h,p,m;if(e==t)h=l,p=m=l.left;else{if(h=o(t-1,"right"),"rtl"==a){var g=l;l=h,h=g}p=l.left,m=h.right}null==r&&0==e&&(p=u),h.top-l.top>3&&(n(p,l.top,null,l.bottom),p=u,l.bottom<h.top&&n(p,l.bottom,null,h.top)),null==i&&t==s&&(m=c),(!d||l.top<d.top||l.top==d.top&&l.left<d.left)&&(d=l),(!f||h.bottom>f.bottom||h.bottom==f.bottom&&h.right>f.right)&&(f=h),u+1>p&&(p=u),n(p,h.top,m-p,h.bottom)}),{start:d,end:f}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=Se(e.display),u=s.left,c=o.lineSpace.offsetWidth-s.right,d=t.from(),f=t.to();if(d.line==f.line)i(d.line,d.ch,f.ch);else{var h=bn(a,d.line),p=bn(a,f.line),m=Br(h)==Br(p),g=i(d.line,d.ch,m?h.text.length+1:null).end,v=i(f.line,m?0:null,f.ch).start;m&&(g.top<v.top-2?(n(g.right,g.top,null,g.bottom),n(u,v.top,v.left,v.bottom)):n(g.right,g.top,v.left-g.right,g.bottom)),g.bottom<v.top&&n(u,g.bottom,null,v.top)}r.appendChild(l)}function ye(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0&&(t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate))}}function be(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,oi(we,e))}function we(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=So(t.mode,ke(e,t.frontier));Ze(e,function(){t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(i){if(t.frontier>=e.display.viewFrom){var o=i.styles,a=tn(e,i,n,!0);i.styles=a.styles,a.classes?i.styleClasses=a.classes:i.styleClasses&&(i.styleClasses=null);for(var l=!o||o.length!=i.styles.length,s=0;!l&&s<o.length;++s)l=o[s]!=i.styles[s];l&&it(e,t.frontier,"text"),i.stateAfter=So(t.mode,n)}else nn(e,i.text,n),i.stateAfter=t.frontier%5==0?So(t.mode,n):null;return++t.frontier,+new Date>r?(be(e,e.options.workDelay),!0):void 0})})}}function xe(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=bn(o,l-1);if(s.stateAfter&&(!r||l<=o.frontier))return l;var u=na(s.text,null,e.options.tabSize);(null==i||n>u)&&(i=l-1,n=u)}return i}function ke(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=xe(e,t,r),a=o>n.first&&bn(n,o-1).stateAfter;return a=a?So(n.mode,a):Mo(n.mode),n.iter(o,t,function(r){nn(e,r.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=l?So(n.mode,a):null,++o}),r&&(n.frontier=o),a}function Ce(e){return e.lineSpace.offsetTop}function Le(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Se(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=ci(e.measure,si("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Me(e,t,r){var n=e.options.lineWrapping,i=n&&e.display.scroller.clientWidth;if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],u=a[l+1];Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Te(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var n=0;n<e.rest.length;n++)if(Cn(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Ae(e,t){t=Br(t);var r=Cn(t),n=e.display.externalMeasured=new tt(e.doc,t,r);n.lineN=r;var i=n.built=an(e,n);return n.text=i.pre,ci(e.display.lineMeasure,i.pre),n}function Ne(e,t,r,n){return ze(e,Oe(e,t),r,n)}function He(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[at(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Oe(e,t){var r=Cn(t),n=He(e,r);n&&!n.text?n=null:n&&n.changes&&O(e,n,r,N(e)),n||(n=Ae(e,t));var i=Te(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function ze(e,t,r,n){t.before&&(r=-1);var i=r+(n||""),o;return t.cache.hasOwnProperty(i)?o=t.cache[i]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Me(e,t.view,t.rect),t.hasHeights=!0),o=Ee(e,t,r,n),o.bogus||(t.cache[i]=o)),{left:o.left,right:o.right,top:o.top,bottom:o.bottom}}function Ee(e,t,r,n){for(var i=t.map,o,a,l,s,u=0;u<i.length;u+=3){var c=i[u],d=i[u+1];if(c>r?(a=0,l=1,s="left"):d>r?(a=r-c,l=a+1):(u==i.length-3||r==d&&i[u+3]>r)&&(l=d-c,a=l-1,r>=d&&(s="right")),null!=a){if(o=i[u+2],c==d&&n==(o.insertLeft?"left":"right")&&(s=n),"left"==n&&0==a)for(;u&&i[u-2]==i[u-3]&&i[u-1].insertLeft;)o=i[(u-=3)+2],s="left";if("right"==n&&a==d-c)for(;u<i.length-3&&i[u+3]==i[u+4]&&!i[u+5].insertLeft;)o=i[(u+=3)+2],s="right";break}}var f;if(3==o.nodeType){for(;a&&li(t.line.text.charAt(c+a));)--a;for(;d>c+l&&li(t.line.text.charAt(c+l));)++l;if(Ii&&0==a&&l==d-c)f=o.parentNode.getBoundingClientRect();else if(_i&&e.options.lineWrapping){var h=ua(o,a,l).getClientRects();f=h.length?h["right"==n?h.length-1:0]:io}else f=ua(o,a,l).getBoundingClientRect()}else{a>0&&(s=n="right");var h;f=e.options.lineWrapping&&(h=o.getClientRects()).length>1?h["right"==n?h.length-1:0]:o.getBoundingClientRect()}if(Ii&&!a&&(!f||!f.left&&!f.right)){var p=o.parentNode.getClientRects()[0];f=p?{left:p.left,right:p.left+$e(e.display),top:p.top,bottom:p.bottom}:io}for(var m,g=(f.bottom+f.top)/2-t.rect.top,v=t.view.measure.heights,u=0;u<v.length-1&&!(g<v[u]);u++);m=u?v[u-1]:0,g=v[u];var y={left:("right"==s?f.right:f.left)-t.rect.left,right:("left"==s?f.left:f.right)-t.rect.left,top:m,bottom:g};return f.left||f.right||(y.bogus=!0),y}function We(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]={};
2
+ }function Ie(e){e.display.externalMeasure=null,ui(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)We(e.display.view[t])}function De(e){Ie(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Pe(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function _e(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function Fe(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=Kr(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=Sn(t);if("local"==n?a+=Ce(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:_e());var s=l.left+("window"==n?0:Pe());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function Be(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=Pe(),i-=_e();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function Re(e,t,r,n,i){return n||(n=bn(e.doc,t.line)),Fe(e,n,Ne(e,n,t.ch,i),r)}function je(e,t,r,n,i){function o(t,o){var a=ze(e,i,t,o?"right":"left");return o?a.left=a.right:a.right=a.left,Fe(e,n,a,r)}function a(e,t){var r=l[t],n=r.level%2;return e==xi(r)&&t&&r.level<l[t-1].level?(r=l[--t],e=ki(r)-(r.level%2?0:1),n=!0):e==ki(r)&&t<l.length-1&&r.level<l[t+1].level&&(r=l[++t],e=xi(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?o(e-1):o(e,n)}n=n||bn(e.doc,t.line),i||(i=Oe(e,n));var l=Mn(n),s=t.ch;if(!l)return o(s);var u=Ai(l,s),c=a(s,u);return null!=ya&&(c.other=a(s,ya)),c}function Ve(e,t){var r=0,t=Q(e.doc,t);e.options.lineWrapping||(r=$e(e.display)*t.ch);var n=bn(e.doc,t.line),i=Sn(n)+Ce(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function qe(e,t,r,n){var i=ro(e,t);return i.xRel=n,r&&(i.outside=!0),i}function Ge(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return qe(n.first,0,!0,-1);var i=Ln(n,r),o=n.first+n.size-1;if(i>o)return qe(n.first+n.size-1,bn(n,o).text.length,!0,1);0>t&&(t=0);for(var a=bn(n,i);;){var l=Ue(e,a,i,t,r),s=_r(a),u=s&&s.find(0,!0);if(!s||!(l.ch>u.from.ch||l.ch==u.from.ch&&l.xRel>0))return l;i=Cn(a=u.to.line)}}function Ue(e,t,r,n,i){function o(n){var i=je(e,ro(r,n),"line",t,u);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-Sn(t),l=!1,s=2*e.display.wrapper.clientWidth,u=Oe(e,t),c=Mn(t),d=t.text.length,f=Ci(t),h=Li(t),p=o(f),m=l,g=o(h),v=l;if(n>g)return qe(r,h,v,1);for(;;){if(c?h==f||h==Hi(t,f,1):1>=h-f){for(var y=p>n||g-n>=n-p?f:h,b=n-(y==f?p:g);li(t.text.charAt(y));)++y;var w=qe(r,y,y==f?m:v,-1>b?-1:b>1?1:0);return w}var x=Math.ceil(d/2),k=f+x;if(c){k=f;for(var C=0;x>C;++C)k=Hi(t,k,1)}var L=o(k);L>n?(h=k,g=L,(v=l)&&(g+=1e3),d=x):(f=k,p=L,m=l,d-=x)}}function Ke(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==oo){oo=si("pre");for(var t=0;49>t;++t)oo.appendChild(document.createTextNode("x")),oo.appendChild(si("br"));oo.appendChild(document.createTextNode("x"))}ci(e.measure,oo);var r=oo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),ui(e.measure),r||1}function $e(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=si("span","xxxxxxxxxx"),r=si("pre",[t]);ci(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ye(e){e.curOp={viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++ao},Zo++||(Xo=[])}function Xe(e){var t=e.curOp,r=e.doc,n=e.display;if(e.curOp=null,t.updateMaxLine&&h(e),t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<n.viewFrom||t.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping){var i=k(e,{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate);e.display.scroller.offsetHeight&&(e.doc.scrollTop=e.display.scroller.scrollTop)}if(!i&&t.selectionChanged&&me(e),i||t.startHeight==e.doc.height||g(e),null!=t.scrollTop&&n.scroller.scrollTop!=t.scrollTop){var o=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,t.scrollTop));n.scroller.scrollTop=n.scrollbarV.scrollTop=r.scrollTop=o}if(null!=t.scrollLeft&&n.scroller.scrollLeft!=t.scrollLeft){var a=Math.max(0,Math.min(n.scroller.scrollWidth-n.scroller.clientWidth,t.scrollLeft));n.scroller.scrollLeft=n.scrollbarH.scrollLeft=r.scrollLeft=a,y(e)}if(t.scrollToPos){var l=rr(e,Q(e.doc,t.scrollToPos.from),Q(e.doc,t.scrollToPos.to),t.scrollToPos.margin);t.scrollToPos.isCursor&&e.state.focused&&tr(e,l)}t.selectionChanged&&ye(e),e.state.focused&&t.updateInput&&ht(e,t.typing);var s=t.maybeHiddenMarkers,u=t.maybeUnhiddenMarkers;if(s)for(var c=0;c<s.length;++c)s[c].lines.length||Yo(s[c],"hide");if(u)for(var c=0;c<u.length;++c)u[c].lines.length&&Yo(u[c],"unhide");var d;if(--Zo||(d=Xo,Xo=null),t.changeObjs&&Yo(e,"changes",e,t.changeObjs),d)for(var c=0;c<d.length;++c)d[c]();if(t.cursorActivityHandlers)for(var c=0;c<t.cursorActivityHandlers.length;c++)t.cursorActivityHandlers[c](e)}function Ze(e,t){if(e.curOp)return t();Ye(e);try{return t()}finally{Xe(e)}}function Qe(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ye(e);try{return t.apply(e,arguments)}finally{Xe(e)}}}function Je(e){return function(){if(this.curOp)return e.apply(this,arguments);Ye(this);try{return e.apply(this,arguments)}finally{Xe(this)}}}function et(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Ye(t);try{return e.apply(this,arguments)}finally{Xe(t)}}}function tt(e,t,r){this.line=t,this.rest=Rr(t),this.size=this.rest?Cn(ei(this.rest))-r+1:1,this.node=this.text=null,this.hidden=qr(e,t)}function rt(e,t,r){for(var n=[],i,o=t;r>o;o=i){var a=new tt(e.doc,bn(e.doc,o),o);i=o+a.size,n.push(a)}return n}function nt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)to&&jr(e.doc,t)<i.viewTo&&ot(e);else if(r<=i.viewFrom)to&&Vr(e.doc,r+n)>i.viewFrom?ot(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)ot(e);else if(t<=i.viewFrom){var o=lt(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):ot(e)}else if(r>=i.viewTo){var o=lt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):ot(e)}else{var a=lt(e,t,t,-1),l=lt(e,r,r+n,1);a&&l?(i.view=i.view.slice(0,a.index).concat(rt(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=n):ot(e)}var s=i.externalMeasured;s&&(r<s.lineN?s.lineN+=n:t<s.lineN+s.size&&(i.externalMeasured=null))}function it(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[at(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==ti(a,r)&&a.push(r)}}}function ot(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function at(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,0>t)return n}function lt(e,t,r,n){var i=at(e,t),o,a=e.display.view;if(!to)return{index:i,lineN:r};for(var l=0,s=e.display.viewFrom;i>l;l++)s+=a[l].size;if(s!=t){if(n>0){if(i==a.length-1)return null;o=s+a[i].size-t,i++}else o=s-t;t+=o,r+=o}for(;jr(e.doc,r)!=r;){if(i==(0>n?0:a.length-1))return null;r+=n*a[i-(0>n?1:0)].size,i+=n}return{index:i,lineN:r}}function st(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=rt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=rt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(at(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(rt(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,at(e,r)))),n.viewTo=r}function ut(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function ct(e){e.display.pollingFast||e.display.poll.set(e.options.pollInterval,function(){ft(e),e.state.focused&&ct(e)})}function dt(e){function t(){var n=ft(e);n||r?(e.display.pollingFast=!1,ct(e)):(r=!0,e.display.poll.set(60,t))}var r=!1;e.display.pollingFast=!0,e.display.poll.set(20,t)}function ft(e){var t=e.display.input,r=e.display.prevInput,n=e.doc;if(!e.state.focused||ma(t)&&!r||gt(e)||e.options.disableInput)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var i=t.value;if(i==r&&!e.somethingSelected())return!1;if(_i&&!Ii&&e.display.inputHasSelection===i)return ht(e),!1;var o=!e.curOp;o&&Ye(e),e.display.shift=!1;for(var a=0,l=Math.min(r.length,i.length);l>a&&r.charCodeAt(a)==i.charCodeAt(a);)++a;for(var s=i.slice(a),u=pa(s),c=e.state.pasteIncoming&&u.length>1&&n.sel.ranges.length==u.length,d=n.sel.ranges.length-1;d>=0;d--){var f=n.sel.ranges[d],h=f.from(),p=f.to();a<r.length?h=ro(h.line,h.ch-(r.length-a)):e.state.overwrite&&f.empty()&&!e.state.pasteIncoming&&(p=ro(p.line,Math.min(bn(n,p.line).text.length,p.ch+ei(u).length)));var m=e.curOp.updateInput,g={from:h,to:p,text:c?[u[d]]:u,origin:e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input"};if($t(e.doc,g),Gn(e,"inputRead",e,g),s&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&f.head.ch<100&&(!d||n.sel.ranges[d-1].head.line!=f.head.line)){var v=e.getModeAt(f.head);if(v.electricChars){for(var y=0;y<v.electricChars.length;y++)if(s.indexOf(v.electricChars.charAt(y))>-1){sr(e,f.head.line,"smart");break}}else if(v.electricInput){var b=go(g);v.electricInput.test(bn(n,b.line).text.slice(0,b.ch))&&sr(e,f.head.line,"smart")}}}return ar(e),e.curOp.updateInput=m,e.curOp.typing=!0,i.length>1e3||i.indexOf("\n")>-1?t.value=e.display.prevInput="":e.display.prevInput=i,o&&Xe(e),e.state.pasteIncoming=e.state.cutIncoming=!1,!0}function ht(e,t){var r,n,i=e.doc;if(e.somethingSelected()){e.display.prevInput="";var o=i.sel.primary();r=ga&&(o.to().line-o.from().line>100||(n=e.getSelection()).length>1e3);var a=r?"-":n||e.getSelection();e.display.input.value=a,e.state.focused&&oa(e.display.input),_i&&!Ii&&(e.display.inputHasSelection=a)}else t||(e.display.prevInput=e.display.input.value="",_i&&!Ii&&(e.display.inputHasSelection=null));e.display.inaccurateSelection=r}function pt(e){"nocursor"==e.options.readOnly||$i&&fi()==e.display.input||e.display.input.focus()}function mt(e){e.state.focused||(pt(e),Ft(e))}function gt(e){return e.options.readOnly||e.doc.cantEdit}function vt(e){function t(){e.state.focused&&setTimeout(oi(pt,e),0)}function r(){null==l&&(l=setTimeout(function(){l=null,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=da=null,e.setSize()},100))}function n(){di(document.body,a.wrapper)?setTimeout(n,5e3):$o(window,"resize",r)}function i(t){Kn(e,t)||Uo(t)}function o(t){if(e.somethingSelected())a.inaccurateSelection&&(a.prevInput="",a.inaccurateSelection=!1,a.input.value=e.getSelection(),oa(a.input));else{for(var r="",n=[],i=0;i<e.doc.sel.ranges.length;i++){var o=e.doc.sel.ranges[i].head.line,l={anchor:ro(o,0),head:ro(o+1,0)};n.push(l),r+=e.getRange(l.anchor,l.head)}"cut"==t.type?e.setSelections(n,null,ea):(a.prevInput="",a.input.value=r,oa(a.input))}"cut"==t.type&&(e.state.cutIncoming=!0)}var a=e.display;Ko(a.scroller,"mousedown",Qe(e,wt)),Ei?Ko(a.scroller,"dblclick",Qe(e,function(t){if(!Kn(e,t)){var r=bt(e,t);if(r&&!St(e,t)&&!yt(e.display,t)){qo(t);var n=hr(e.doc,r);ne(e.doc,n.anchor,n.head)}}})):Ko(a.scroller,"dblclick",function(t){Kn(e,t)||qo(t)}),Ko(a.lineSpace,"selectstart",function(e){yt(a,e)||qo(e)}),Ji||Ko(a.scroller,"contextmenu",function(t){Rt(e,t)}),Ko(a.scroller,"scroll",function(){a.scroller.clientHeight&&(At(e,a.scroller.scrollTop),Nt(e,a.scroller.scrollLeft,!0),Yo(e,"scroll",e))}),Ko(a.scrollbarV,"scroll",function(){a.scroller.clientHeight&&At(e,a.scrollbarV.scrollTop)}),Ko(a.scrollbarH,"scroll",function(){a.scroller.clientHeight&&Nt(e,a.scrollbarH.scrollLeft)}),Ko(a.scroller,"mousewheel",function(t){Ht(e,t)}),Ko(a.scroller,"DOMMouseScroll",function(t){Ht(e,t)}),Ko(a.scrollbarH,"mousedown",t),Ko(a.scrollbarV,"mousedown",t),Ko(a.wrapper,"scroll",function(){a.wrapper.scrollTop=a.wrapper.scrollLeft=0});var l;Ko(window,"resize",r),setTimeout(n,5e3),Ko(a.input,"keyup",Qe(e,Pt)),Ko(a.input,"input",function(){_i&&!Ii&&e.display.inputHasSelection&&(e.display.inputHasSelection=null),dt(e)}),Ko(a.input,"keydown",Qe(e,It)),Ko(a.input,"keypress",Qe(e,_t)),Ko(a.input,"focus",oi(Ft,e)),Ko(a.input,"blur",oi(Bt,e)),e.options.dragDrop&&(Ko(a.scroller,"dragstart",function(t){Tt(e,t)}),Ko(a.scroller,"dragenter",i),Ko(a.scroller,"dragover",i),Ko(a.scroller,"drop",Qe(e,Mt))),Ko(a.scroller,"paste",function(t){yt(a,t)||(e.state.pasteIncoming=!0,pt(e),dt(e))}),Ko(a.input,"paste",function(){if(Fi&&!e.state.fakedLastChar&&!(new Date-e.state.lastMiddleDown<200)){var t=a.input.selectionStart,r=a.input.selectionEnd;a.input.value+="$",a.input.selectionStart=t,a.input.selectionEnd=r,e.state.fakedLastChar=!0}e.state.pasteIncoming=!0,dt(e)}),Ko(a.input,"cut",o),Ko(a.input,"copy",o),qi&&Ko(a.sizer,"mouseup",function(){fi()==a.input&&a.input.blur(),pt(e)})}function yt(e,t){for(var r=Vn(t);r!=e.wrapper;r=r.parentNode)if(!r||r.ignoreEvents||r.parentNode==e.sizer&&r!=e.mover)return!0}function bt(e,t,r,n){var i=e.display;if(!r){var o=Vn(t);if(o==i.scrollbarH||o==i.scrollbarV||o==i.scrollbarFiller||o==i.gutterFiller)return null}var a,l,s=i.lineSpace.getBoundingClientRect();try{a=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var u=Ge(e,a,l),c;if(n&&1==u.xRel&&(c=bn(e.doc,u.line).text).length==u.ch){var d=na(c,c.length,e.options.tabSize)-c.length;u=ro(u.line,Math.max(0,Math.round((a-Se(e.display).left)/$e(e.display))-d))}return u}function wt(e){if(!Kn(this,e)){var t=this,r=t.display;if(r.shift=e.shiftKey,yt(r,e))return void(Fi||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!St(t,e)){var n=bt(t,e);switch(window.focus(),qn(e)){case 1:n?xt(t,e,n):Vn(e)==r.scroller&&qo(e);break;case 2:Fi&&(t.state.lastMiddleDown=+new Date),n&&ne(t.doc,n),setTimeout(oi(pt,t),20),qo(e);break;case 3:Ji&&Rt(t,e)}}}}function xt(e,t,r){setTimeout(oi(mt,e),0);var n=+new Date,i;so&&so.time>n-400&&0==no(so.pos,r)?i="triple":lo&&lo.time>n-400&&0==no(lo.pos,r)?(i="double",so={time:n,pos:r}):(i="single",lo={time:n,pos:r});var o=e.doc.sel,a=Yi?t.metaKey:t.ctrlKey;e.options.dragDrop&&ca&&!a&&!gt(e)&&"single"==i&&o.contains(r)>-1&&o.somethingSelected()?kt(e,t,r):Ct(e,t,r,i,a)}function kt(e,t,r){var n=e.display,i=Qe(e,function(o){Fi&&(n.scroller.draggable=!1),e.state.draggingText=!1,$o(document,"mouseup",i),$o(n.scroller,"drop",i),Math.abs(t.clientX-o.clientX)+Math.abs(t.clientY-o.clientY)<10&&(qo(o),ne(e.doc,r),pt(e),Ei&&!Ii&&setTimeout(function(){document.body.focus(),pt(e)},20))});Fi&&(n.scroller.draggable=!0),e.state.draggingText=i,n.scroller.dragDrop&&n.scroller.dragDrop(),Ko(document,"mouseup",i),Ko(n.scroller,"drop",i)}function Ct(e,t,r,n,i){function o(t){if(0!=no(m,t))if(m=t,"rect"==n){for(var i=[],o=e.options.tabSize,a=na(bn(u,r.line).text,r.ch,o),l=na(bn(u,t.line).text,t.ch,o),s=Math.min(a,l),h=Math.max(a,l),p=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));g>=p;p++){var v=bn(u,p).text,y=Qn(v,s,o);s==h?i.push(new K(ro(p,y),ro(p,y))):v.length>y&&i.push(new K(ro(p,y),ro(p,Qn(v,h,o))))}i.length||i.push(new K(r,r)),ue(u,Y(f.ranges.slice(0,d).concat(i),d),ta)}else{var b=c,w=b.anchor,x=t;if("single"!=n){if("double"==n)var k=hr(u,t);else var k=new K(ro(t.line,0),Q(u,ro(t.line+1,0)));no(k.anchor,w)>0?(x=k.head,w=G(b.from(),k.anchor)):(x=k.anchor,w=q(b.to(),k.head))}var i=f.ranges.slice(0);i[d]=new K(Q(u,w),x),ue(u,Y(i,d),ta)}}function a(t){var r=++y,i=bt(e,t,!0,"rect"==n);if(i)if(0!=no(i,m)){mt(e),o(i);var l=v(s,u);(i.line>=l.to||i.line<l.from)&&setTimeout(Qe(e,function(){y==r&&a(t)}),150)}else{var c=t.clientY<g.top?-20:t.clientY>g.bottom?20:0;c&&setTimeout(Qe(e,function(){y==r&&(s.scroller.scrollTop+=c,a(t))}),50)}}function l(t){y=1/0,qo(t),pt(e),$o(document,"mousemove",b),$o(document,"mouseup",w),u.history.lastSelOrigin=null}var s=e.display,u=e.doc;qo(t);var c,d,f=u.sel;if(i&&!t.shiftKey?(d=u.sel.contains(r),c=d>-1?u.sel.ranges[d]:new K(r,r)):c=u.sel.primary(),t.altKey)n="rect",i||(c=new K(r,r)),r=bt(e,t,!0,!0),d=-1;else if("double"==n){var h=hr(u,r);c=e.display.shift||u.extend?re(u,c,h.anchor,h.head):h}else if("triple"==n){var p=new K(ro(r.line,0),Q(u,ro(r.line+1,0)));c=e.display.shift||u.extend?re(u,c,p.anchor,p.head):p}else c=re(u,c,r);i?d>-1?oe(u,d,c,ta):(d=u.sel.ranges.length,ue(u,Y(u.sel.ranges.concat([c]),d),{scroll:!1,origin:"*mouse"})):(d=0,ue(u,new U([c],0),ta),f=u.sel);var m=r,g=s.wrapper.getBoundingClientRect(),y=0,b=Qe(e,function(e){(_i&&!Di?e.buttons:qn(e))?a(e):l(e)}),w=Qe(e,l);Ko(document,"mousemove",b),Ko(document,"mouseup",w)}function Lt(e,t,r,n,i){try{var o=t.clientX,a=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&qo(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(a>s.bottom||!Yn(e,r))return jn(t);a-=s.top-l.viewOffset;for(var u=0;u<e.options.gutters.length;++u){var c=l.gutters.childNodes[u];if(c&&c.getBoundingClientRect().right>=o){var d=Ln(e.doc,a),f=e.options.gutters[u];return i(e,r,e,d,f,t),jn(t)}}}function St(e,t){return Lt(e,t,"gutterClick",!0,Gn)}function Mt(e){var t=this;if(!Kn(t,e)&&!yt(t.display,e)){qo(e),_i&&(uo=+new Date);var r=bt(t,e,!0),n=e.dataTransfer.files;if(r&&!gt(t))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,l=function(e,n){var l=new FileReader;l.onload=Qe(t,function(){if(o[n]=l.result,++a==i){r=Q(t.doc,r);var e={from:r,to:r,text:pa(o.join("\n")),origin:"paste"};$t(t.doc,e),se(t.doc,X(r,go(e)))}}),l.readAsText(e)},s=0;i>s;++s)l(n[s],s);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(oi(pt,t),20);try{var o=e.dataTransfer.getData("Text");if(o){var u=t.state.draggingText&&t.listSelections();if(ce(t.doc,X(r,r)),u)for(var s=0;s<u.length;++s)er(t.doc,"",u[s].anchor,u[s].head,"drag");t.replaceSelection(o,"around","paste"),pt(t)}}catch(e){}}}}function Tt(e,t){if(_i&&(!e.state.draggingText||+new Date-uo<100))return void Uo(t);if(!Kn(e,t)&&!yt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!Vi)){var r=si("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",ji&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),ji&&r.parentNode.removeChild(r)}}function At(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,zi||k(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbarV.scrollTop!=t&&(e.display.scrollbarV.scrollTop=t),zi&&k(e),be(e,100))}function Nt(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,y(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbarH.scrollLeft!=t&&(e.display.scrollbarH.scrollLeft=t))}function Ht(e,t){var r=t.wheelDeltaX,n=t.wheelDeltaY;null==r&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(r=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta);var i=e.display,o=i.scroller;if(r&&o.scrollWidth>o.clientWidth||n&&o.scrollHeight>o.clientHeight){if(n&&Yi&&Fi)e:for(var a=t.target,l=i.view;a!=o;a=a.parentNode)for(var s=0;s<l.length;s++)if(l[s].node==a){e.display.currentWheelTarget=a;break e}if(r&&!zi&&!ji&&null!=fo)return n&&At(e,Math.max(0,Math.min(o.scrollTop+n*fo,o.scrollHeight-o.clientHeight))),Nt(e,Math.max(0,Math.min(o.scrollLeft+r*fo,o.scrollWidth-o.clientWidth))),qo(t),void(i.wheelStartX=null);if(n&&null!=fo){var u=n*fo,c=e.doc.scrollTop,d=c+i.wrapper.clientHeight;0>u?c=Math.max(0,c+u-50):d=Math.min(e.doc.height,d+u+50),k(e,{top:c,bottom:d})}20>co&&(null==i.wheelStartX?(i.wheelStartX=o.scrollLeft,i.wheelStartY=o.scrollTop,i.wheelDX=r,i.wheelDY=n,setTimeout(function(){if(null!=i.wheelStartX){var e=o.scrollLeft-i.wheelStartX,t=o.scrollTop-i.wheelStartY,r=t&&i.wheelDY&&t/i.wheelDY||e&&i.wheelDX&&e/i.wheelDX;i.wheelStartX=i.wheelStartY=null,r&&(fo=(fo*co+r)/(co+1),++co)}},200)):(i.wheelDX+=r,i.wheelDY+=n))}}function Ot(e,t,r){if("string"==typeof t&&(t=To[t],!t))return!1;e.display.pollingFast&&ft(e)&&(e.display.pollingFast=!1);var n=e.display.shift,i=!1;try{gt(e)&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Jo}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function zt(e){var t=e.state.keyMaps.slice(0);return e.options.extraKeys&&t.push(e.options.extraKeys),t.push(e.options.keyMap),t}function Et(e,t){var r=mr(e.options.keyMap),n=r.auto;clearTimeout(ho),n&&!Ho(t)&&(ho=setTimeout(function(){mr(e.options.keyMap)==r&&(e.options.keyMap=n.call?n.call(null,e):n,l(e))},50));var i=Oo(t,!0),o=!1;if(!i)return!1;var a=zt(e);return o=t.shiftKey?No("Shift-"+i,a,function(t){return Ot(e,t,!0)})||No(i,a,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?Ot(e,t):void 0}):No(i,a,function(t){return Ot(e,t)}),o&&(qo(t),ye(e),Gn(e,"keyHandled",e,i,t)),o}function Wt(e,t,r){var n=No("'"+r+"'",zt(e),function(t){return Ot(e,t,!0)});return n&&(qo(t),ye(e),Gn(e,"keyHandled",e,"'"+r+"'",t)),n}function It(e){var t=this;if(mt(t),!Kn(t,e)){Ei&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=Et(t,e);ji&&(po=n?r:null,!n&&88==r&&!ga&&(Yi?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||Dt(t)}}function Dt(e){function t(e){18!=e.keyCode&&e.altKey||(pi(r,"CodeMirror-crosshair"),$o(document,"keyup",t),$o(document,"mouseover",t))}var r=e.display.lineDiv;mi(r,"CodeMirror-crosshair"),Ko(document,"keyup",t),Ko(document,"mouseover",t)}function Pt(e){Kn(this,e)||16==e.keyCode&&(this.doc.sel.shift=!1)}function _t(e){var t=this;if(!Kn(t,e)){var r=e.keyCode,n=e.charCode;if(ji&&r==po)return po=null,void qo(e);if(!(ji&&(!e.which||e.which<10)||qi)||!Et(t,e)){var i=String.fromCharCode(null==n?r:n);Wt(t,e,i)||(_i&&!Ii&&(t.display.inputHasSelection=null),dt(t))}}}function Ft(e){"nocursor"!=e.options.readOnly&&(e.state.focused||(Yo(e,"focus",e),e.state.focused=!0,mi(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu!=e.doc.sel||(ht(e),Fi&&setTimeout(oi(ht,e,!0),0))),ct(e),ye(e))}function Bt(e){e.state.focused&&(Yo(e,"blur",e),e.state.focused=!1,pi(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Rt(e,t){function r(){if(null!=i.input.selectionStart){var t=e.somethingSelected(),r=i.input.value="​"+(t?i.input.value:"");i.prevInput=t?"":"​",i.input.selectionStart=1,i.input.selectionEnd=r.length}}function n(){if(i.inputDiv.style.position="relative",i.input.style.cssText=s,Ii&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=a),ct(e),null!=i.input.selectionStart){(!_i||Ii)&&r(),clearTimeout(mo);var t=0,n=function(){i.selForContextMenu==e.doc.sel&&0==i.input.selectionStart?Qe(e,To.selectAll)(e):t++<10?mo=setTimeout(n,500):ht(e)};mo=setTimeout(n,200)}}if(!Kn(e,t,"contextmenu")){var i=e.display;if(!yt(i,t)&&!jt(e,t)){var o=bt(e,t),a=i.scroller.scrollTop;if(o&&!ji){var l=e.options.resetSelectionOnContextMenu;l&&-1==e.doc.sel.contains(o)&&Qe(e,ue)(e.doc,X(o),ea);var s=i.input.style.cssText;if(i.inputDiv.style.position="absolute",i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(t.clientY-5)+"px; left: "+(t.clientX-5)+"px; z-index: 1000; background: "+(_i?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",pt(e),ht(e),e.somethingSelected()||(i.input.value=i.prevInput=" "),i.selForContextMenu=e.doc.sel,_i&&!Ii&&r(),Ji){Uo(t);var u=function(){$o(window,"mouseup",u),setTimeout(n,20)};Ko(window,"mouseup",u)}else setTimeout(n,50)}}}}function jt(e,t){return Yn(e,"gutterContextMenu")?Lt(e,t,"gutterContextMenu",!1,Yo):!1}function Vt(e,t){if(no(e,t.from)<0)return e;if(no(e,t.to)<=0)return go(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=go(t).ch-t.to.ch),ro(r,n)}function qt(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new K(Vt(i.anchor,t),Vt(i.head,t)))}return Y(r,e.sel.primIndex)}function Gt(e,t,r){return e.line==t.line?ro(r.line,e.ch-t.ch+r.ch):ro(r.line+(e.line-t.line),e.ch)}function Ut(e,t,r){for(var n=[],i=ro(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Gt(l.from,i,o),u=Gt(go(l),i,o);if(i=l.to,o=u,"around"==r){var c=e.sel.ranges[a],d=no(c.head,c.anchor)<0;n[a]=new K(d?u:s,d?s:u)}else n[a]=new K(s,s)}return new U(n,e.sel.primIndex)}function Kt(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(t,r,n,i){t&&(this.from=Q(e,t)),r&&(this.to=Q(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),Yo(e,"beforeChange",e,n),e.cm&&Yo(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function $t(e,t,r){if(e.cm){if(!e.cm.curOp)return Qe(e.cm,$t)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Yn(e,"beforeChange")||e.cm&&Yn(e.cm,"beforeChange"))||(t=Kt(e,t,!0))){var n=eo&&!r&&Hr(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Yt(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Yt(e,t)}}function Yt(e,t){if(1!=t.text.length||""!=t.text[0]||0!=no(t.from,t.to)){var r=qt(e,t);On(e,t,r,e.cm?e.cm.curOp.id:NaN),Qt(e,t,r,Tr(e,t));var n=[];vn(e,function(e,r){r||-1!=ti(n,e.history)||(Rn(e.history,t),n.push(e.history)),Qt(e,t,null,Tr(e,t))})}}function Xt(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n=e.history,i,o=e.sel,a="undo"==t?n.done:n.undone,l="undo"==t?n.undone:n.done,s=0;s<a.length&&(i=a[s],r?!i.ranges||i.equals(e.sel):i.ranges);s++);if(s!=a.length){for(n.lastOrigin=n.lastSelOrigin=null;i=a.pop(),i.ranges;){if(Wn(i,l),r&&!i.equals(e.sel))return void ue(e,i,{clearRedo:!1});o=i}var u=[];Wn(o,l),l.push({changes:u,generation:n.generation}),n.generation=i.generation||++n.maxGeneration;for(var c=Yn(e,"beforeChange")||e.cm&&Yn(e.cm,"beforeChange"),s=i.changes.length-1;s>=0;--s){var d=i.changes[s];if(d.origin=t,c&&!Kt(e,d,!1))return void(a.length=0);u.push(An(e,d));var f=s?qt(e,d,null):ei(a);Qt(e,d,f,Nr(e,d)),e.cm&&ar(e.cm);var h=[];vn(e,function(e,t){t||-1!=ti(h,e.history)||(Rn(e.history,d),h.push(e.history)),Qt(e,d,null,Nr(e,d))})}}}}function Zt(e,t){e.first+=t,e.sel=new U(ri(e.sel.ranges,function(e){return new K(ro(e.anchor.line+t,e.anchor.ch),ro(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm&&nt(e.cm,e.first,e.first-t,t)}function Qt(e,t,r,n){if(e.cm&&!e.cm.curOp)return Qe(e.cm,Qt)(e,t,r,n);if(t.to.line<e.first)return void Zt(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Zt(e,i),t={from:ro(e.first,0),to:ro(t.to.line+i,t.to.ch),text:[ei(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:ro(o,bn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=wn(e,t.from,t.to),r||(r=qt(e,t,null)),e.cm?Jt(e.cm,t,n):pn(e,t,n),ce(e,r,ea)}}function Jt(e,t,r){var n=e.doc,i=e.display,a=t.from,l=t.to,s=!1,u=a.line;e.options.lineWrapping||(u=Cn(Br(bn(n,a.line))),n.iter(u,l.line+1,function(e){return e==i.maxLine?(s=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&$n(e),pn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(u,a.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),be(e,400);var c=t.text.length-(l.line-a.line)-1;a.line!=l.line||1!=t.text.length||hn(e.doc,t)?nt(e,a.line,l.line+1,c):it(e,a.line,"text");var d=Yn(e,"changes"),h=Yn(e,"change");if(h||d){var p={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};h&&Gn(e,"change",e,p),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}}function er(e,t,r,n,i){if(n||(n=r),no(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=pa(t)),$t(e,{from:r,to:n,text:t,origin:i})}function tr(e,t){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!Ui){var o=si("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-Ce(e.display))+"px; height: "+(t.bottom-t.top+Qo)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}function rr(e,t,r,n){for(null==n&&(n=0);;){var i=!1,o=je(e,t),a=r&&r!=t?je(e,r):o,l=ir(e,Math.min(o.left,a.left),Math.min(o.top,a.top)-n,Math.max(o.left,a.left),Math.max(o.bottom,a.bottom)+n),s=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=l.scrollTop&&(At(e,l.scrollTop),Math.abs(e.doc.scrollTop-s)>1&&(i=!0)),null!=l.scrollLeft&&(Nt(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(i=!0)),!i)return o}}function nr(e,t,r,n,i){var o=ir(e,t,r,n,i);null!=o.scrollTop&&At(e,o.scrollTop),null!=o.scrollLeft&&Nt(e,o.scrollLeft)}function ir(e,t,r,n,i){var o=e.display,a=Ke(e.display);0>r&&(r=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=o.scroller.clientHeight-Qo,u={},c=e.doc.height+Le(o),d=a>r,f=i>c-a;if(l>r)u.scrollTop=d?0:r;else if(i>l+s){var h=Math.min(r,(f?c:i)-s);h!=l&&(u.scrollTop=h)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=o.scroller.clientWidth-Qo;t+=o.gutters.offsetWidth,n+=o.gutters.offsetWidth;var g=o.gutters.offsetWidth,v=g+10>t;return p+g>t||v?(v&&(t=0),u.scrollLeft=Math.max(0,t-10-g)):n>m+p-3&&(u.scrollLeft=n+10-m),u}function or(e,t,r){(null!=t||null!=r)&&lr(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function ar(e){lr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?ro(t.line,t.ch-1):t,n=ro(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function lr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=Ve(e,t.from),n=Ve(e,t.to),i=ir(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function sr(e,t,r,n){var i=e.doc,o;null==r&&(r="add"),"smart"==r&&(e.doc.mode.indent?o=ke(e,t):r="prev");var a=e.options.tabSize,l=bn(i,t),s=na(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var u=l.text.match(/^\s*/)[0],c;if(n||/\S/.test(l.text)){if("smart"==r&&(c=e.doc.mode.indent(o,l.text.slice(u.length),l.text),c==Jo)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>i.first?na(bn(i,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)f+=a,d+=" ";if(c>f&&(d+=Jn(c-f)),d!=u)er(e.doc,d,ro(t,0),ro(t,u.length),"+input");else for(var h=0;h<i.sel.ranges.length;h++){var p=i.sel.ranges[h];if(p.head.line==t&&p.head.ch<u.length){var f=ro(t,u.length);oe(i,h,new K(f,f));break}}l.stateAfter=null}function ur(e,t,r,n){var i=t,o=t,a=e.doc;return"number"==typeof t?o=bn(a,Z(a,t)):i=Cn(t),null==i?null:(n(o,i)&&it(e,i,r),o)}function cr(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&no(o.from,ei(n).to)<=0;){var a=n.pop();if(no(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}Ze(e,function(){
3
+ for(var t=n.length-1;t>=0;t--)er(e.doc,"",n[t].from,n[t].to,"+delete");ar(e)})}function dr(e,t,r,n,i){function o(){var t=l+r;return t<e.first||t>=e.first+e.size?d=!1:(l=t,c=bn(e,t))}function a(e){var t=(i?Hi:Oi)(c,s,r,!0);if(null==t){if(e||!o())return d=!1;s=i?(0>r?Li:Ci)(c):0>r?c.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,u=r,c=bn(e,l),d=!0;if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var f=null,h="group"==n,p=!0;!(0>r)||a(!p);p=!1){var m=c.text.charAt(s)||"\n",g=la(m)?"w":h&&"\n"==m?"n":!h||/\s/.test(m)?null:"p";if(!h||p||g||(g="s"),f&&f!=g){0>r&&(r=1,a());break}if(g&&(f=g),r>0&&!a(!p))break}var v=pe(e,ro(l,s),u,!0);return d||(v.hitSide=!0),v}function fr(e,t,r,n){var i=e.doc,o=t.left,a;if("page"==n){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);a=t.top+r*(l-(0>r?1.5:.5)*Ke(e.display))}else"line"==n&&(a=r>0?t.bottom+3:t.top-3);for(;;){var s=Ge(e,o,a);if(!s.outside)break;if(0>r?0>=a:a>=i.height){s.hitSide=!0;break}a+=5*r}return s}function hr(e,t){var r=bn(e,t.line).text,n=t.ch,i=t.ch;if(r){(t.xRel<0||i==r.length)&&n?--n:++i;for(var o=r.charAt(n),a=la(o)?la:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!la(e)};n>0&&a(r.charAt(n-1));)--n;for(;i<r.length&&a(r.charAt(i));)++i}return new K(ro(t.line,n),ro(t.line,i))}function pr(t,r,n,i){e.defaults[t]=r,n&&(yo[t]=i?function(e,t,r){r!=bo&&n(e,t,r)}:n)}function mr(e){return"string"==typeof e?Ao[e]:e}function gr(e,t,r,n,i){if(n&&n.shared)return vr(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Qe(e.cm,gr)(e,t,r,n,i);var o=new Eo(e,i),a=no(t,r);if(n&&ii(n,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=si("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||(o.widgetNode.ignoreEvents=!0),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Fr(e,t.line,t,r,o)||t.line!=r.line&&Fr(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");to=!0}o.addToHistory&&On(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var l=t.line,s=e.cm,u;if(e.iter(l,r.line+1,function(e){s&&o.collapsed&&!s.options.lineWrapping&&Br(e)==s.display.maxLine&&(u=!0),o.collapsed&&l!=t.line&&kn(e,0),Lr(e,new xr(o,l==t.line?t.ch:null,l==r.line?r.ch:null)),++l}),o.collapsed&&e.iter(t.line,r.line+1,function(t){qr(e,t)&&kn(t,0)}),o.clearOnEnter&&Ko(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(eo=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Wo,o.atomic=!0),s){if(u&&(s.curOp.updateMaxLine=!0),o.collapsed)nt(s,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle)for(var c=t.line;c<=r.line;c++)it(s,c,"text");o.atomic&&fe(s.doc),Gn(s,"markerAdded",s,o)}return o}function vr(e,t,r,n,i){n=ii(n),n.shared=!1;var o=[gr(e,t,r,n,i)],a=o[0],l=n.widgetNode;return vn(e,function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push(gr(e,Q(e,t),Q(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=ei(o)}),new Io(o,a)}function yr(e){return e.findMarks(ro(e.first,0),e.clipPos(ro(e.lastLine())),function(e){return e.parent})}function br(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(no(o,a)){var l=gr(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}function wr(e){for(var t=0;t<e.length;t++){var r=e[t],n=[r.primary.doc];vn(r.primary.doc,function(e){n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==ti(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}}}function xr(e,t,r){this.marker=e,this.from=t,this.to=r}function kr(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Cr(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Lr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Sr(e,t,r){if(e)for(var n=0,i;n<e.length;++n){var o=e[n],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(i||(i=[])).push(new xr(a,o.from,s?null:o.to))}}return i}function Mr(e,t,r){if(e)for(var n=0,i;n<e.length;++n){var o=e[n],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(i||(i=[])).push(new xr(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return i}function Tr(e,t){var r=ee(e,t.from.line)&&bn(e,t.from.line).markedSpans,n=ee(e,t.to.line)&&bn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==no(t.from,t.to),l=Sr(r,i,a),s=Mr(n,o,a),u=1==t.text.length,c=ei(t.text).length+(u?i:0);if(l)for(var d=0;d<l.length;++d){var f=l[d];if(null==f.to){var h=kr(s,f.marker);h?u&&(f.to=null==h.to?null:h.to+c):f.to=i}}if(s)for(var d=0;d<s.length;++d){var f=s[d];if(null!=f.to&&(f.to+=c),null==f.from){var h=kr(l,f.marker);h||(f.from=c,u&&(l||(l=[])).push(f))}else f.from+=c,u&&(l||(l=[])).push(f)}l&&(l=Ar(l)),s&&s!=l&&(s=Ar(s));var p=[l];if(!u){var m=t.text.length-2,g;if(m>0&&l)for(var d=0;d<l.length;++d)null==l[d].to&&(g||(g=[])).push(new xr(l[d].marker,null,null));for(var d=0;m>d;++d)p.push(g);p.push(s)}return p}function Ar(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Nr(e,t){var r=Pn(e,t),n=Tr(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function Hr(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=ti(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var u=i[s];if(!(no(u.to,l.from)<0||no(u.from,l.to)>0)){var c=[s,1],d=no(u.from,l.from),f=no(u.to,l.to);(0>d||!a.inclusiveLeft&&!d)&&c.push({from:u.from,to:l.from}),(f>0||!a.inclusiveRight&&!f)&&c.push({from:l.to,to:u.to}),i.splice.apply(i,c),s+=c.length-1}}return i}function Or(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function zr(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Er(e){return e.inclusiveLeft?-1:0}function Wr(e){return e.inclusiveRight?1:0}function Ir(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=no(n.from,i.from)||Er(e)-Er(t);if(o)return-o;var a=no(n.to,i.to)||Wr(e)-Wr(t);return a?a:t.id-e.id}function Dr(e,t){var r=to&&e.markedSpans,n;if(r)for(var i,o=0;o<r.length;++o)i=r[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!n||Ir(n,i.marker)<0)&&(n=i.marker);return n}function Pr(e){return Dr(e,!0)}function _r(e){return Dr(e,!1)}function Fr(e,t,r,n,i){var o=bn(e,t),a=to&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var u=s.marker.find(0),c=no(u.from,r)||Er(s.marker)-Er(i),d=no(u.to,n)||Wr(s.marker)-Wr(i);if(!(c>=0&&0>=d||0>=c&&d>=0)&&(0>=c&&(no(u.to,r)||Wr(s.marker)-Er(i))>0||c>=0&&(no(u.from,n)||Er(s.marker)-Wr(i))<0))return!0}}}function Br(e){for(var t;t=Pr(e);)e=t.find(-1,!0).line;return e}function Rr(e){for(var t,r;t=_r(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function jr(e,t){var r=bn(e,t),n=Br(r);return r==n?t:Cn(n)}function Vr(e,t){if(t>e.lastLine())return t;var r=bn(e,t),n;if(!qr(e,r))return t;for(;n=_r(r);)r=n.find(1,!0).line;return Cn(r)+1}function qr(e,t){var r=to&&t.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Gr(e,t,n))return!0}}function Gr(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Gr(e,n.line,kr(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Gr(e,t,i))return!0}function Ur(e,t,r){Sn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&or(e,null,r)}function Kr(e){return null!=e.height?e.height:(di(document.body,e.node)||ci(e.cm.display.measure,si("div",[e.node],null,"position: relative")),e.height=e.node.offsetHeight)}function $r(e,t,r,n){var i=new Do(e,r,n);return i.noHScroll&&(e.display.alignWidgets=!0),ur(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,!qr(e.doc,t)){var n=Sn(t)<e.doc.scrollTop;kn(t,t.height+Kr(i)),n&&or(e,null,i.height),e.curOp.forceUpdate=!0}return!0}),i}function Yr(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Or(e),zr(e,r);var i=n?n(e):1;i!=e.height&&kn(e,i)}function Xr(e){e.parent=null,Or(e)}function Zr(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Qr(t,r){if(t.blankLine)return t.blankLine(r);if(t.innerMode){var n=e.innerMode(t,r);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Jr(e,t,r){var n=e.token(t,r);if(t.pos<=t.start)throw new Error("Mode "+e.name+" failed to advance stream.");return n}function en(t,r,n,i,o,a,l){var s=n.flattenSpans;null==s&&(s=t.options.flattenSpans);var u=0,c=null,d=new zo(r,t.options.tabSize),f;for(""==r&&Zr(Qr(n,i),a);!d.eol();){if(d.pos>t.options.maxHighlightLength?(s=!1,l&&nn(t,r,i,d.pos),d.pos=r.length,f=null):f=Zr(Jr(n,d,i),a),t.options.addModeClass){var h=e.innerMode(n,i).mode.name;h&&(f="m-"+(f?h+" "+f:h))}s&&c==f||(u<d.start&&o(d.start,c),u=d.start,c=f),d.start=d.pos}for(;u<d.pos;){var p=Math.min(d.pos,u+5e4);o(p,c),u=p}}function tn(e,t,r,n){var i=[e.state.modeGen],o={};en(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},o,n);for(var a=0;a<e.state.overlays.length;++a){var l=e.state.overlays[a],s=1,u=0;en(e,t.text,l.mode,!0,function(e,t){for(var r=s;e>u;){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n),s+=2,u=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,s-r,e,"cm-overlay "+t),s=r+2;else for(;s>r;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function rn(e,t){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=tn(e,t,t.stateAfter=ke(e,Cn(t)));t.styles=r.styles,r.classes?t.styleClasses=r.classes:t.styleClasses&&(t.styleClasses=null)}return t.styles}function nn(e,t,r,n){var i=e.doc.mode,o=new zo(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&Qr(i,r);!o.eol()&&o.pos<=e.options.maxHighlightLength;)Jr(i,o,r),o.start=o.pos}function on(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Fo:_o;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function an(e,t){var r=si("span",null,null,Fi?"padding-right: .1px":null),n={pre:si("pre",[r]),content:r,col:0,pos:0,cm:e};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a;n.pos=0,n.addToken=sn,(_i||Fi)&&e.getOption("lineWrapping")&&(n.addToken=un(n.addToken)),bi(e.display.measure)&&(a=Mn(o))&&(n.addToken=cn(n.addToken,a)),n.map=[],fn(o,n,rn(e,o)),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=gi(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=gi(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(yi(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return Yo(e,"renderLine",e,t.line,n.pre),n}function ln(e){var t=si("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t}function sn(e,t,r,n,i,o){if(t){var a=e.cm.options.specialChars,l=!1;if(a.test(t))for(var s=document.createDocumentFragment(),u=0;;){a.lastIndex=u;var c=a.exec(t),d=c?c.index-u:t.length-u;if(d){var f=document.createTextNode(t.slice(u,u+d));Ii?s.appendChild(si("span",[f])):s.appendChild(f),e.map.push(e.pos,e.pos+d,f),e.col+=d,e.pos+=d}if(!c)break;if(u+=d+1," "==c[0]){var h=e.cm.options.tabSize,p=h-e.col%h,f=s.appendChild(si("span",Jn(p),"cm-tab"));e.col+=p}else{var f=e.cm.options.specialCharPlaceholder(c[0]);Ii?s.appendChild(si("span",[f])):s.appendChild(f),e.col+=1}e.map.push(e.pos,e.pos+1,f),e.pos++}else{e.col+=t.length;var s=document.createTextNode(t);e.map.push(e.pos,e.pos+t.length,s),Ii&&(l=!0),e.pos+=t.length}if(r||n||i||l){var m=r||"";n&&(m+=n),i&&(m+=i);var g=si("span",[s],m);return o&&(g.title=o),e.content.appendChild(g)}e.content.appendChild(s)}}function un(e){function t(e){for(var t=" ",r=0;r<e.length-2;++r)t+=r%2?" ":" ";return t+=" "}return function(r,n,i,o,a,l){e(r,n.replace(/ {3,}/g,t),i,o,a,l)}}function cn(e,t){return function(r,n,i,o,a,l){i=i?i+" cm-force-border":"cm-force-border";for(var s=r.pos,u=s+n.length;;){for(var c=0;c<t.length;c++){var d=t[c];if(d.to>s&&d.from<=s)break}if(d.to>=u)return e(r,n,i,o,a,l);e(r,n.slice(0,d.to-s),i,o,null,l),o=null,n=n.slice(d.to-s),s=d.to}}}function dn(e,t,r,n){var i=!n&&r.widgetNode;i&&(e.map.push(e.pos,e.pos+t,i),e.content.appendChild(i)),e.pos+=t}function fn(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a=i.length,l=0,s=1,u="",c,d=0,f,h,p,m,g;;){if(d==l){f=h=p=m="",g=null,d=1/0;for(var v=[],y=0;y<n.length;++y){var b=n[y],w=b.marker;b.from<=l&&(null==b.to||b.to>l)?(null!=b.to&&d>b.to&&(d=b.to,h=""),w.className&&(f+=" "+w.className),w.startStyle&&b.from==l&&(p+=" "+w.startStyle),w.endStyle&&b.to==d&&(h+=" "+w.endStyle),w.title&&!m&&(m=w.title),w.collapsed&&(!g||Ir(g.marker,w)<0)&&(g=b)):b.from>l&&d>b.from&&(d=b.from),"bookmark"==w.type&&b.from==l&&w.widgetNode&&v.push(w)}if(g&&(g.from||0)==l&&(dn(t,(null==g.to?a+1:g.to)-l,g.marker,null==g.from),null==g.to))return;if(!g&&v.length)for(var y=0;y<v.length;++y)dn(t,0,v[y])}if(l>=a)break;for(var x=Math.min(a,d);;){if(u){var k=l+u.length;if(!g){var C=k>x?u.slice(0,x-l):u;t.addToken(t,C,c?c+f:f,p,l+C.length==d?h:"",m)}if(k>=x){u=u.slice(x-l),l=x;break}l=k,p=""}u=i.slice(o,o=r[s++]),c=on(r[s++],t.cm.options)}}else for(var s=1;s<r.length;s+=2)t.addToken(t,i.slice(o,o=r[s]),on(r[s+1],t.cm.options))}function hn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==ei(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function pn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){Yr(e,r,i,n),Gn(e,"change",e,t)}var a=t.from,l=t.to,s=t.text,u=bn(e,a.line),c=bn(e,l.line),d=ei(s),f=i(s.length-1),h=l.line-a.line;if(hn(e,t)){for(var p=0,m=[];p<s.length-1;++p)m.push(new Po(s[p],i(p),n));o(c,c.text,f),h&&e.remove(a.line,h),m.length&&e.insert(a.line,m)}else if(u==c)if(1==s.length)o(u,u.text.slice(0,a.ch)+d+u.text.slice(l.ch),f);else{for(var m=[],p=1;p<s.length-1;++p)m.push(new Po(s[p],i(p),n));m.push(new Po(d+u.text.slice(l.ch),f,n)),o(u,u.text.slice(0,a.ch)+s[0],i(0)),e.insert(a.line+1,m)}else if(1==s.length)o(u,u.text.slice(0,a.ch)+s[0]+c.text.slice(l.ch),i(0)),e.remove(a.line+1,h);else{o(u,u.text.slice(0,a.ch)+s[0],i(0)),o(c,d+c.text.slice(l.ch),f);for(var p=1,m=[];p<s.length-1;++p)m.push(new Po(s[p],i(p),n));h>1&&e.remove(a.line+1,h-1),e.insert(a.line+1,m)}Gn(e,"change",e,t)}function mn(e){this.lines=e,this.parent=null;for(var t=0,r=0;t<e.length;++t)e[t].parent=this,r+=e[t].height;this.height=r}function gn(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}function vn(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;(!r||s)&&(t(l.doc,s),n(l.doc,e,s))}}}n(e,null,!0)}function yn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),r(e),e.options.lineWrapping||h(e),e.options.mode=t.modeOption,nt(e)}function bn(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(o>t){r=i;break}t-=o}return r.lines[t]}function wn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function xn(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function kn(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function Cn(e){if(null==e.parent)return null;for(var t=e.parent,r=ti(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function Ln(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(o>t){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;n<e.lines.length;++n){var a=e.lines[n],l=a.height;if(l>t)break;t-=l}return r+n}function Sn(e){e=Br(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var n=0;n<o.children.length;++n){var a=o.children[n];if(a==r)break;t+=a.height}return t}function Mn(e){var t=e.order;return null==t&&(t=e.order=ba(e.text)),t}function Tn(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function An(e,t){var r={from:V(t.from),to:go(t),text:wn(e,t.from,t.to)};return In(e,r,t.from.line,t.to.line+1),vn(e,function(e){In(e,r,t.from.line,t.to.line+1)},!0),r}function Nn(e){for(;e.length;){var t=ei(e);if(!t.ranges)break;e.pop()}}function Hn(e,t){return t?(Nn(e.done),ei(e.done)):e.done.length&&!ei(e.done).ranges?ei(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),ei(e.done)):void 0}function On(e,t,r,n){var i=e.history;i.undone.length=0;var o=+new Date,a;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>o-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(a=Hn(i,i.lastOp==n))){var l=ei(a.changes);0==no(t.from,t.to)&&0==no(t.from,l.to)?l.to=go(t):a.changes.push(An(e,t))}else{var s=ei(i.done);for(s&&s.ranges||Wn(e.sel,i.done),a={changes:[An(e,t)],generation:i.generation},i.done.push(a);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=o,i.lastOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||Yo(e,"historyAdded")}function zn(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function En(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||zn(e,o,ei(i.done),t))?i.done[i.done.length-1]=t:Wn(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastOp=r,n&&n.clearRedo!==!1&&Nn(i.undone)}function Wn(e,t){var r=ei(t);r&&r.ranges&&r.equals(e)||t.push(e)}function In(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function Dn(e){if(!e)return null;for(var t=0,r;t<e.length;++t)e[t].marker.explicitlyCleared?r||(r=e.slice(0,t)):r&&r.push(e[t]);return r?r.length?r:null:e}function Pn(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(Dn(r[n]));return i}function _n(e,t,r){for(var n=0,i=[];n<e.length;++n){var o=e[n];if(o.ranges)i.push(r?U.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];i.push({changes:l});for(var s=0;s<a.length;++s){var u=a[s],c;if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&ti(t,Number(c[1]))>-1&&(ei(l)[d]=u[d],delete u[d])}}}return i}function Fn(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Bn(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var l=0;l<o.ranges.length;l++)Fn(o.ranges[l].anchor,t,r,n),Fn(o.ranges[l].head,t,r,n)}else{for(var l=0;l<o.changes.length;++l){var s=o.changes[l];if(r<s.from.line)s.from=ro(s.from.line+n,s.from.ch),s.to=ro(s.to.line+n,s.to.ch);else if(t<=s.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function Rn(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;Bn(e.done,r,n,i),Bn(e.undone,r,n,i)}function jn(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Vn(e){return e.target||e.srcElement}function qn(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Yi&&e.ctrlKey&&1==t&&(t=3),t}function Gn(e,t){function r(e){return function(){e.apply(null,i)}}var n=e._handlers&&e._handlers[t];if(n){var i=Array.prototype.slice.call(arguments,2);Xo||(++Zo,Xo=[],setTimeout(Un,0));for(var o=0;o<n.length;++o)Xo.push(r(n[o]))}}function Un(){--Zo;var e=Xo;Xo=null;for(var t=0;t<e.length;++t)e[t]()}function Kn(e,t,r){return Yo(e,r||t.type,e,t),jn(t)||t.codemirrorIgnore}function $n(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==ti(r,t[n])&&r.push(t[n])}function Yn(e,t){var r=e._handlers&&e._handlers[t];return r&&r.length>0}function Xn(e){e.prototype.on=function(e,t){Ko(this,e,t)},e.prototype.off=function(e,t){$o(this,e,t)}}function Zn(){this.id=null}function Qn(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}function Jn(e){for(;ia.length<=e;)ia.push(ei(ia)+" ");return ia[e]}function ei(e){return e[e.length-1]}function ti(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function ri(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function ni(e,t){var r;if(Object.create)r=Object.create(e);else{var n=function(){};n.prototype=e,r=new n}return t&&ii(t,r),r}function ii(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||r===!1&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function oi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ai(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function li(e){return e.charCodeAt(0)>=768&&sa.test(e)}function si(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function ui(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function ci(e,t){return ui(e).appendChild(t)}function di(e,t){if(e.contains)return e.contains(t);for(;t=t.parentNode;)if(t==e)return!0}function fi(){return document.activeElement}function hi(e){return new RegExp("\\b"+e+"\\b\\s*")}function pi(e,t){var r=hi(t);r.test(e.className)&&(e.className=e.className.replace(r,""))}function mi(e,t){hi(t).test(e.className)||(e.className+=" "+t)}function gi(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!hi(r[n]).test(t)&&(t+=" "+r[n]);return t}function vi(e){if(null!=da)return da;var t=si("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return ci(e,t),t.offsetWidth&&(da=t.offsetHeight-t.clientHeight),da||0}function yi(e){if(null==fa){var t=si("span","​");ci(e,si("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(fa=t.offsetWidth<=1&&t.offsetHeight>2&&!Wi)}return fa?si("span","​"):si("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function bi(e){if(null!=ha)return ha;var t=ci(e,document.createTextNode("AخA")),r=ua(t,0,1).getBoundingClientRect();if(r.left==r.right)return!1;var n=ua(t,1,2).getBoundingClientRect();return ha=n.right-r.right<3}function wi(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function xi(e){return e.level%2?e.to:e.from}function ki(e){return e.level%2?e.from:e.to}function Ci(e){var t=Mn(e);return t?xi(t[0]):0}function Li(e){var t=Mn(e);return t?ki(ei(t)):e.text.length}function Si(e,t){var r=bn(e.doc,t),n=Br(r);n!=r&&(t=Cn(n));var i=Mn(n),o=i?i[0].level%2?Li(n):Ci(n):0;return ro(t,o)}function Mi(e,t){for(var r,n=bn(e.doc,t);r=_r(n);)n=r.find(1,!0).line,t=null;var i=Mn(n),o=i?i[0].level%2?Ci(n):Li(n):n.text.length;return ro(null==t?Cn(n):t,o)}function Ti(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function Ai(e,t){ya=null;for(var r=0,n;r<e.length;++r){var i=e[r];if(i.from<t&&i.to>t)return r;if(i.from==t||i.to==t){if(null!=n)return Ti(e,i.level,e[n].level)?(i.from!=i.to&&(ya=n),r):(i.from!=i.to&&(ya=r),n);n=r}}return n}function Ni(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&li(e.text.charAt(t)));return t}function Hi(e,t,r,n){var i=Mn(e);if(!i)return Oi(e,t,r,n);for(var o=Ai(i,t),a=i[o],l=Ni(e,t,a.level%2?-r:r,n);;){if(l>a.from&&l<a.to)return l;if(l==a.from||l==a.to)return Ai(i,l)==o?l:(a=i[o+=r],r>0==a.level%2?a.to:a.from);if(a=i[o+=r],!a)return null;l=r>0==a.level%2?Ni(e,a.to,-1,n):Ni(e,a.from,1,n)}}function Oi(e,t,r,n){var i=t+r;if(n)for(;i>0&&li(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var zi=/gecko\/\d/i.test(navigator.userAgent),Ei=/MSIE \d/.test(navigator.userAgent),Wi=Ei&&(null==document.documentMode||document.documentMode<8),Ii=Ei&&(null==document.documentMode||document.documentMode<9),Di=Ei&&(null==document.documentMode||document.documentMode<10),Pi=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),_i=Ei||Pi,Fi=/WebKit\//.test(navigator.userAgent),Bi=Fi&&/Qt\/\d+\.\d+/.test(navigator.userAgent),Ri=/Chrome\//.test(navigator.userAgent),ji=/Opera\//.test(navigator.userAgent),Vi=/Apple Computer/.test(navigator.vendor),qi=/KHTML\//.test(navigator.userAgent),Gi=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Ui=/PhantomJS/.test(navigator.userAgent),Ki=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),$i=Ki||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Yi=Ki||/Mac/.test(navigator.platform),Xi=/win/i.test(navigator.platform),Zi=ji&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Zi&&(Zi=Number(Zi[1])),Zi&&Zi>=15&&(ji=!1,Fi=!0);var Qi=Yi&&(Bi||ji&&(null==Zi||12.11>Zi)),Ji=zi||_i&&!Ii,eo=!1,to=!1,ro=e.Pos=function(e,t){return this instanceof ro?(this.line=e,void(this.ch=t)):new ro(e,t)},no=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch};U.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(0!=no(r.anchor,n.anchor)||0!=no(r.head,n.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new K(V(this.ranges[t].anchor),V(this.ranges[t].head));return new U(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(no(t,n.from())>=0&&no(e,n.to())<=0)return r}return-1}},K.prototype={from:function(){return G(this.anchor,this.head)},to:function(){return q(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var io={left:0,right:0,top:0,bottom:0},oo,ao=0,lo,so,uo=0,co=0,fo=null;_i?fo=-.53:zi?fo=15:Ri?fo=-.7:Vi&&(fo=-1/3);var ho,po=null,mo,go=e.changeEnd=function(e){return e.text?ro(e.from.line+e.text.length-1,ei(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),pt(this),dt(this)},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,yo.hasOwnProperty(e)&&Qe(this,yo[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](e)},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||"string"!=typeof t[r]&&t[r].name==e)return t.splice(r,1),!0},addOverlay:Je(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:t,opaque:r&&r.opaque}),this.state.modeGen++,nt(this)}),removeOverlay:Je(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void nt(this)}}),indentLine:Je(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),ee(this.doc,e)&&sr(this,e,t,r)}),indentSelection:Je(function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(sr(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&ar(this));else{var o=Math.max(r,i.from().line),a=i.to();r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=o;r>l;++l)sr(this,l,e)}}}),getTokenAt:function(e,t){var r=this.doc;e=Q(r,e);for(var n=ke(this,e.line,t),i=this.doc.mode,o=bn(r,e.line),a=new zo(o.text,this.options.tabSize);a.pos<e.ch&&!a.eol();){a.start=a.pos;var l=Jr(i,a,n)}return{start:a.start,end:a.pos,string:a.current(),type:l||null,state:n}},getTokenTypeAt:function(e){e=Q(this.doc,e);var t=rn(this,bn(this.doc,e.line)),r=0,n=(t.length-1)/2,i=e.ch,o;if(0==i)o=t[2];else for(;;){var a=r+n>>1;if((a?t[2*a-1]:0)>=i)n=a;else{if(!(t[2*a+1]<i)){o=t[2*a+2];break}r=a+1}}var l=o?o.indexOf("cm-overlay "):-1;return 0>l?o:0==l?null:o.slice(0,l-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!Lo.hasOwnProperty(t))return Lo;var n=Lo[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var a=n[i[t][o]];a&&r.push(a)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var o=0;o<n._global.length;o++){var l=n._global[o];l.pred(i,this)&&-1==ti(r,l.val)&&r.push(l.val)}return r},getStateAfter:function(e,t){var r=this.doc;return e=Z(r,null==e?r.first+r.size-1:e),ke(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?Q(this.doc,e):e?n.from():n.to(),je(this,r,t||"page")},charCoords:function(e,t){return Re(this,Q(this.doc,e),t||"page")},coordsChar:function(e,t){return e=Be(this,e,t||"page"),Ge(this,e.left,e.top)},lineAtHeight:function(e,t){return e=Be(this,{top:e,left:0},t||"page").top,Ln(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r=!1,n=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>n&&(e=n,r=!0);var i=bn(this.doc,e);return Fe(this,i,{top:0,left:0},t||"page").top+(r?this.doc.height-Sn(i):0)},defaultTextHeight:function(){return Ke(this.display)},defaultCharWidth:function(){return $e(this.display)},setGutterMarker:Je(function(e,t,r){return ur(this,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&ai(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Je(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,it(t,n,"gutter"),ai(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),addLineClass:Je(function(e,t,r){return ur(this,e,"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"wrapClass";
4
+ if(e[n]){if(new RegExp("(?:^|\\s)"+r+"(?:$|\\s)").test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:Je(function(e,t,r){return ur(this,e,"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(new RegExp("(?:^|\\s+)"+r+"(?:$|\\s+)"));if(!o)return!1;var a=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:Je(function(e,t,r){return $r(this,e,t,r)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if("number"==typeof e){if(!ee(this.doc,e))return null;var t=e;if(e=bn(this.doc,e),!e)return null}else{var t=Cn(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=je(this,Q(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>u&&(l=u-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),r&&nr(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Je(It),triggerOnKeyPress:Je(_t),triggerOnKeyUp:Je(Pt),execCommand:function(e){return To.hasOwnProperty(e)?To[e](this):void 0},findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=Q(this.doc,e);t>o&&(a=dr(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:Je(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?dr(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},ra)}),deleteH:Je(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):cr(this,function(r){var i=dr(n,r.head,e,t,!1);return 0>e?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var a=0,l=Q(this.doc,e);t>a;++a){var s=je(this,l,"div");if(null==o?o=s.left:s.left=o,l=fr(this,s,i,r),l.hitSide)break}return l},moveV:Je(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var l=je(r,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=fr(r,l,e,t);return"page"==t&&a==n.sel.primary()&&or(r,null,Re(r,s,"div").top-l.top),s},ra),i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]}),toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?mi(this.display.cursorDiv,"CodeMirror-overwrite"):pi(this.display.cursorDiv,"CodeMirror-overwrite"),Yo(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return fi()==this.display.input},scrollTo:Je(function(e,t){(null!=e||null!=t)&&lr(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller,t=Qo;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-t,width:e.scrollWidth-t,clientHeight:e.clientHeight-t,clientWidth:e.clientWidth-t}},scrollIntoView:Je(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:ro(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)lr(this),this.curOp.scrollToPos=e;else{var r=ir(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(r.scrollLeft,r.scrollTop)}}),setSize:Je(function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&Ie(this),this.curOp.forceUpdate=!0,Yo(this,"refresh",this)}),operation:function(e){return Ze(this,e)},refresh:Je(function(){var e=this.display.cachedTextHeight;nt(this),this.curOp.forceUpdate=!0,De(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),d(this),(null==e||Math.abs(e-Ke(this.display))>.5)&&a(this),Yo(this,"refresh",this)}),swapDoc:Je(function(e){var t=this.doc;return t.cm=null,yn(this,e),De(this),ht(this),this.scrollTo(e.scrollLeft,e.scrollTop),Gn(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Xn(e);var vo=e.defaults={},yo=e.optionHandlers={},bo=e.Init={toString:function(){return"CodeMirror.Init"}};pr("value","",function(e,t){e.setValue(t)},!0),pr("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),pr("indentUnit",2,r,!0),pr("indentWithTabs",!1),pr("smartIndent",!0),pr("tabSize",4,function(e){n(e),De(e),nt(e)},!0),pr("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(e,t){e.options.specialChars=new RegExp(t.source+(t.test(" ")?"":"| "),"g"),e.refresh()},!0),pr("specialCharPlaceholder",ln,function(e){e.refresh()},!0),pr("electricChars",!0),pr("rtlMoveVisually",!Xi),pr("wholeLineUpdateBefore",!0),pr("theme","default",function(e){s(e),u(e)},!0),pr("keyMap","default",l),pr("extraKeys",null),pr("lineWrapping",!1,i,!0),pr("gutters",[],function(e){p(e.options),u(e)},!0),pr("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?x(e.display)+"px":"0",e.refresh()},!0),pr("coverGutterNextToScrollbar",!1,g,!0),pr("lineNumbers",!1,function(e){p(e.options),u(e)},!0),pr("firstLineNumber",1,u,!0),pr("lineNumberFormatter",function(e){return e},u,!0),pr("showCursorWhenSelecting",!1,me,!0),pr("resetSelectionOnContextMenu",!0),pr("readOnly",!1,function(e,t){"nocursor"==t?(Bt(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||ht(e))}),pr("disableInput",!1,function(e,t){t||ht(e)},!0),pr("dragDrop",!0),pr("cursorBlinkRate",530),pr("cursorScrollMargin",0),pr("cursorHeight",1),pr("workTime",100),pr("workDelay",100),pr("flattenSpans",!0,n,!0),pr("addModeClass",!1,n,!0),pr("pollInterval",100),pr("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),pr("historyEventDelay",1250),pr("viewportMargin",10,function(e){e.refresh()},!0),pr("maxHighlightLength",1e4,n,!0),pr("moveInputWithCursor",!0,function(e,t){t||(e.display.inputDiv.style.top=e.display.inputDiv.style.left=0)}),pr("tabindex",null,function(e,t){e.display.input.tabIndex=t||""}),pr("autofocus",null);var wo=e.modes={},xo=e.mimeModes={};e.defineMode=function(t,r){if(e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2){r.dependencies=[];for(var n=2;n<arguments.length;++n)r.dependencies.push(arguments[n])}wo[t]=r},e.defineMIME=function(e,t){xo[e]=t},e.resolveMode=function(t){if("string"==typeof t&&xo.hasOwnProperty(t))t=xo[t];else if(t&&"string"==typeof t.name&&xo.hasOwnProperty(t.name)){var r=xo[t.name];"string"==typeof r&&(r={name:r}),t=ni(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=wo[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(ko.hasOwnProperty(r.name)){var o=ko[r.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var a in r.modeProps)i[a]=r.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var ko=e.modeExtensions={};e.extendMode=function(e,t){var r=ko.hasOwnProperty(e)?ko[e]:ko[e]={};ii(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){Ro.prototype[e]=t},e.defineOption=pr;var Co=[];e.defineInitHook=function(e){Co.push(e)};var Lo=e.helpers={};e.registerHelper=function(t,r,n){Lo.hasOwnProperty(t)||(Lo[t]=e[t]={_global:[]}),Lo[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),Lo[t]._global.push({pred:n,val:i})};var So=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},Mo=e.startState=function(e,t,r){return e.startState?e.startState(t,r):!0};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var To=e.commands={selectAll:function(e){e.setSelection(ro(e.firstLine(),0),ro(e.lastLine()),ea)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ea)},killLine:function(e){cr(e,function(t){if(t.empty()){var r=bn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:ro(t.head.line+1,0)}:{from:t.head,to:ro(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){cr(e,function(t){return{from:ro(t.from().line,0),to:Q(e.doc,ro(t.to().line+1,0))}})},delLineLeft:function(e){cr(e,function(e){return{from:ro(e.from().line,0),to:e.from()}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(ro(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(ro(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return Si(e,t.head.line)},ra)},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){var r=Si(e,t.head.line),n=e.getLineHandle(r.line),i=Mn(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.head.line==r.line&&t.head.ch<=o&&t.head.ch;return ro(r.line,a?0:o)}return r},ra)},goLineEnd:function(e){e.extendSelectionsBy(function(t){return Mi(e,t.head.line)},ra)},goLineRight:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},ra)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var r=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},ra)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),a=na(e.getLine(o.line),o.ch,n);t.push(new Array(n-a%n+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){Ze(e,function(){for(var t=e.listSelections(),r=0;r<t.length;r++){var n=t[r].head,i=bn(e.doc,n.line).text;n.ch>0&&n.ch<i.length-1&&e.replaceRange(i.charAt(n.ch)+i.charAt(n.ch-1),ro(n.line,n.ch-1),ro(n.line,n.ch+1))}})},newlineAndIndent:function(e){Ze(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange("\n",n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0),ar(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},Ao=e.keyMap={};Ao.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"},Ao.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","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"},Ao.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","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":"delLineLeft","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection",fallthrough:["basic","emacsy"]},Ao.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},Ao["default"]=Yi?Ao.macDefault:Ao.pcDefault;var No=e.lookupKey=function(e,t,r){function n(t){t=mr(t);var i=t[e];if(i===!1)return"stop";if(null!=i&&r(i))return!0;if(t.nofallthrough)return"stop";var o=t.fallthrough;if(null==o)return!1;if("[object Array]"!=Object.prototype.toString.call(o))return n(o);for(var a=0;a<o.length;++a){var l=n(o[a]);if(l)return l}return!1}for(var i=0;i<t.length;++i){var o=n(t[i]);if(o)return"stop"!=o}},Ho=e.isModifierKey=function(e){var t=va[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},Oo=e.keyName=function(e,t){if(ji&&34==e.keyCode&&e["char"])return!1;var r=va[e.keyCode];return null==r||e.altGraphKey?!1:(e.altKey&&(r="Alt-"+r),(Qi?e.metaKey:e.ctrlKey)&&(r="Ctrl-"+r),(Qi?e.ctrlKey:e.metaKey)&&(r="Cmd-"+r),!t&&e.shiftKey&&(r="Shift-"+r),r)};e.fromTextArea=function(t,r){function n(){t.value=u.getValue()}if(r||(r={}),r.value=t.value,!r.tabindex&&t.tabindex&&(r.tabindex=t.tabindex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus){var i=fi();r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Ko(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var o=t.form,a=o.submit;try{var l=o.submit=function(){n(),o.submit=a,o.submit(),o.submit=l}}catch(s){}}t.style.display="none";var u=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return u.save=n,u.getTextArea=function(){return t},u.toTextArea=function(){n(),t.parentNode.removeChild(u.getWrapperElement()),t.style.display="",t.form&&($o(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=a))},u};var zo=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};zo.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var r=t==e;else var r=t&&(e.test?e.test(t):e(t));return r?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=na(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?na(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return na(this.string,null,this.tabSize)-(this.lineStart?na(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var Eo=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e};Xn(Eo),Eo.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Ye(e),Yn(this,"clear")){var r=this.find();r&&Gn(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=kr(a.markedSpans,this);e&&!this.collapsed?it(e,Cn(a),"text"):e&&(null!=l.to&&(i=Cn(a)),null!=l.from&&(n=Cn(a))),a.markedSpans=Cr(a.markedSpans,l),null==l.from&&this.collapsed&&!qr(this.doc,a)&&e&&kn(a,Ke(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var s=Br(this.lines[o]),u=f(s);u>e.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&nt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&fe(e.doc)),e&&Gn(e,"markerCleared",e,this),t&&Xe(e),this.parent&&this.parent.clear()}},Eo.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var o=this.lines[i],a=kr(o.markedSpans,this);if(null!=a.from&&(r=ro(t?o:Cn(o),a.from),-1==e))return r;if(null!=a.to&&(n=ro(t?o:Cn(o),a.to),1==e))return n}return r&&{from:r,to:n}},Eo.prototype.changed=function(){var e=this.find(-1,!0),t=this,r=this.doc.cm;e&&r&&Ze(r,function(){var n=e.line,i=Cn(e.line),o=He(r,i);if(o&&(We(o),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!qr(t.doc,n)&&null!=t.height){var a=t.height;t.height=null;var l=Kr(t)-a;l&&kn(n,n.height+l)}})},Eo.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=ti(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Eo.prototype.detachLine=function(e){if(this.lines.splice(ti(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var Wo=0,Io=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};Xn(Io),Io.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Gn(this,"clear")}},Io.prototype.find=function(e,t){return this.primary.find(e,t)};var Do=e.LineWidget=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.cm=e,this.node=t};Xn(Do),Do.prototype.clear=function(){var e=this.cm,t=this.line.widgets,r=this.line,n=Cn(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=Kr(this);Ze(e,function(){Ur(e,r,-o),it(e,n,"widget"),kn(r,Math.max(0,r.height-o))})}},Do.prototype.changed=function(){var e=this.height,t=this.cm,r=this.line;this.height=null;var n=Kr(this)-e;n&&Ze(t,function(){t.curOp.forceUpdate=!0,Ur(t,r,n),kn(r,r.height+n)})};var Po=e.Line=function(e,t,r){this.text=e,zr(this,t),this.height=r?r(this):1};Xn(Po),Po.prototype.lineNo=function(){return Cn(this)};var _o={},Fo={};mn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;n>r;++r){var i=this.lines[r];this.height-=i.height,Xr(i),Gn(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;n>e;++e)if(r(this.lines[e]))return!0}},gn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(i>e){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof mn))){var l=[];this.collapse(l),this.children=[new mn(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),l=new mn(a);i.height-=l.height,this.children.splice(n+1,0,l),l.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new gn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=ti(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new gn(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(o>e){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var Bo=0,Ro=e.Doc=function(e,t,r){if(!(this instanceof Ro))return new Ro(e,t,r);null==r&&(r=0),gn.call(this,[new mn([new Po("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var n=ro(r,0);this.sel=X(n),this.history=new Tn(null),this.id=++Bo,this.modeOption=t,"string"==typeof e&&(e=pa(e)),pn(this,{from:n,to:n,text:e}),ue(this,X(n),ea)};Ro.prototype=ni(gn.prototype,{constructor:Ro,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=xn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:et(function(e){var t=ro(this.first,0),r=this.first+this.size-1;$t(this,{from:t,to:ro(r,bn(this,r).text.length),text:pa(e),origin:"setValue"},!0),ue(this,X(t))}),replaceRange:function(e,t,r,n){t=Q(this,t),r=r?Q(this,r):t,er(this,e,t,r,n)},getRange:function(e,t,r){var n=wn(this,Q(this,e),Q(this,t));return r===!1?n:n.join(r||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return ee(this,e)?bn(this,e):void 0},getLineNumber:function(e){return Cn(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=bn(this,e)),Br(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Q(this,e)},getCursor:function(e){var t=this.sel.primary(),r;return r=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||e===!1?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:et(function(e,t,r){ae(this,Q(this,"number"==typeof e?ro(e,t||0):e),null,r)}),setSelection:et(function(e,t,r){ae(this,Q(this,e),Q(this,t||e),r)}),extendSelection:et(function(e,t,r){ne(this,Q(this,e),t&&Q(this,t),r)}),extendSelections:et(function(e,t){ie(this,te(this,e,t))}),extendSelectionsBy:et(function(e,t){ie(this,ri(this.sel.ranges,e),t)}),setSelections:et(function(e,t,r){if(e.length){for(var n=0,i=[];n<e.length;n++)i[n]=new K(Q(this,e[n].anchor),Q(this,e[n].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),ue(this,Y(i,t),r)}}),addSelection:et(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new K(Q(this,e),Q(this,t||e))),ue(this,Y(n,n.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,n=0;n<t.length;n++){var i=wn(this,t[n].from(),t[n].to());r=r?r.concat(i):i}return e===!1?r:r.join(e||"\n")},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=wn(this,r[n].from(),r[n].to());e!==!1&&(i=i.join(e||"\n")),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:et(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];n[o]={from:a.from(),to:a.to(),text:pa(e[o]),origin:r}}for(var l=t&&"end"!=t&&Ut(this,n,t),o=n.length-1;o>=0;o--)$t(this,n[o]);l?se(this,l):this.cm&&ar(this.cm)}),undo:et(function(){Xt(this,"undo")}),redo:et(function(){Xt(this,"redo")}),undoSelection:et(function(){Xt(this,"undo",!0)}),redoSelection:et(function(){Xt(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new Tn(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:_n(this.history.done),undone:_n(this.history.undone)}},setHistory:function(e){var t=this.history=new Tn(this.history.maxGeneration);t.done=_n(e.done.slice(0),null,!0),t.undone=_n(e.undone.slice(0),null,!0)},markText:function(e,t,r){return gr(this,Q(this,e),Q(this,t),r,"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared};return e=Q(this,e),gr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=Q(this,e);var t=[],r=bn(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=Q(this,e),t=Q(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];i==e.line&&e.ch>s.to||null==s.from&&i!=e.line||i==t.line&&s.from>t.ch||r&&!r(s.marker)||n.push(s.marker.parent||s.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first;return this.iter(function(n){var i=n.text.length+1;return i>e?(t=e,!0):(e-=i,void++r)}),Q(this,ro(r,t))},indexFromPos:function(e){e=Q(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new Ro(xn(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Ro(xn(this,t,r),e.mode||this.modeOption,t);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],br(n,yr(this)),n},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=this.linked[r];if(n.doc==t){this.linked.splice(r,1),t.unlinkDoc(this),wr(yr(this));break}}if(t.history==this.history){var i=[t.id];vn(t,function(e){i.push(e.id)},!0),t.history=new Tn(null),t.history.done=_n(this.history.done,i),t.history.undone=_n(this.history.undone,i)}},iterLinkedDocs:function(e){vn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),Ro.prototype.eachLine=Ro.prototype.iter;var jo="iter insert remove copy getEditor".split(" ");for(var Vo in Ro.prototype)Ro.prototype.hasOwnProperty(Vo)&&ti(jo,Vo)<0&&(e.prototype[Vo]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ro.prototype[Vo]));Xn(Ro);var qo=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},Go=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},Uo=e.e_stop=function(e){qo(e),Go(e)},Ko=e.on=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={}),i=n[t]||(n[t]=[]);i.push(r)}},$o=e.off=function(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers&&e._handlers[t];if(!n)return;for(var i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}}},Yo=e.signal=function(e,t){var r=e._handlers&&e._handlers[t];if(r)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)},Xo,Zo=0,Qo=30,Jo=e.Pass={toString:function(){return"CodeMirror.Pass"}},ea={scroll:!1},ta={origin:"*mouse"},ra={origin:"+move"};Zn.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var na=e.countColumn=function(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=n||0,a=i||0;;){var l=e.indexOf(" ",o);if(0>l||l>=t)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}},ia=[""],oa=function(e){e.select()};Ki?oa=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:_i&&(oa=function(e){try{e.select()}catch(t){}}),[].indexOf&&(ti=function(e,t){return e.indexOf(t)}),[].map&&(ri=function(e,t){return e.map(t)});var aa=/[\u00df\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,la=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||aa.test(e))},sa=/[\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]/,ua;
5
  ua=document.createRange?function(e,t,r){var n=document.createRange();return n.setEnd(e,r),n.setStart(e,t),n}:function(e,t,r){var n=document.body.createTextRange();return n.moveToElementText(e.parentNode),n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n},Ei&&(fi=function(){try{return document.activeElement}catch(e){return document.body}});var ca=function(){if(Ii)return!1;var e=si("div");return"draggable"in e||"dragDrop"in e}(),da,fa,ha,pa=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ma=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},ga=function(){var e=si("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),va={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};e.keyNames=va,function(){for(var e=0;10>e;e++)va[e+48]=va[e+96]=String(e);for(var e=65;90>=e;e++)va[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)va[e+111]=va[e+63235]="F"+e}();var ya,ba=function(){function e(e){return 247>=e?r.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?n.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,u="L";return function(r){if(!i.test(r))return!1;for(var n=r.length,c=[],d=0,f;n>d;++d)c.push(f=e(r.charCodeAt(d)));for(var d=0,h=u;n>d;++d){var f=c[d];"m"==f?c[d]=h:h=f}for(var d=0,p=u;n>d;++d){var f=c[d];"1"==f&&"r"==p?c[d]="n":a.test(f)&&(p=f,"r"==f&&(c[d]="R"))}for(var d=1,h=c[0];n-1>d;++d){var f=c[d];"+"==f&&"1"==h&&"1"==c[d+1]?c[d]="1":","!=f||h!=c[d+1]||"1"!=h&&"n"!=h||(c[d]=h),h=f}for(var d=0;n>d;++d){var f=c[d];if(","==f)c[d]="N";else if("%"==f){for(var m=d+1;n>m&&"%"==c[m];++m);for(var g=d&&"!"==c[d-1]||n>m&&"1"==c[m]?"1":"N",v=d;m>v;++v)c[v]=g;d=m-1}}for(var d=0,p=u;n>d;++d){var f=c[d];"L"==p&&"1"==f?c[d]="L":a.test(f)&&(p=f)}for(var d=0;n>d;++d)if(o.test(c[d])){for(var m=d+1;n>m&&o.test(c[m]);++m);for(var y="L"==(d?c[d-1]:u),b="L"==(n>m?c[m]:u),g=y||b?"L":"R",v=d;m>v;++v)c[v]=g;d=m-1}for(var w=[],x,d=0;n>d;)if(l.test(c[d])){var k=d;for(++d;n>d&&l.test(c[d]);++d);w.push(new t(0,k,d))}else{var C=d,L=w.length;for(++d;n>d&&"L"!=c[d];++d);for(var v=C;d>v;)if(s.test(c[v])){v>C&&w.splice(L,0,new t(1,C,v));var S=v;for(++v;d>v&&s.test(c[v]);++v);w.splice(L,0,new t(2,S,v)),C=v}else++v;d>C&&w.splice(L,0,new t(1,C,d))}return 1==w[0].level&&(x=r.match(/^\s+/))&&(w[0].from=x[0].length,w.unshift(new t(0,0,x[0].length))),1==ei(w).level&&(x=r.match(/\s+$/))&&(ei(w).to-=x[0].length,w.push(new t(0,n-x[0].length,n))),w[0].level!=ei(w).level&&w.push(new t(w[0].level,n,n)),w}}();return e.version="4.1.0",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=!0;return t}function r(e,t){for(var r=!1,n;null!=(n=e.next());){if(r&&"/"==n){t.tokenize=null;break}r="*"==n}return["comment","comment"]}function n(e,t){return e.skipTo("-->")?(e.match("-->"),t.tokenize=null):e.skipToEnd(),["comment","comment"]}e.defineMode("css",function(t,r){function n(e,t){return C=t,e}function i(e,t){var r=e.next();if(p[r]){var i=p[r](e,t);if(i!==!1)return i}return"@"==r?(e.eatWhile(/[\w\\\-]/),n("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?n(null,"compare"):'"'==r||"'"==r?(t.tokenize=o(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),n("atom","hash")):"!"==r?(e.match(/^\s*\w*/),n("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),n("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?n(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?n(null,r):"u"==r&&e.match("rl(")?(e.backUp(1),t.tokenize=a,n("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),n("number","unit")):e.match(/^[^-]+-/)?n("meta","meta"):void 0}function o(e){return function(t,r){for(var i=!1,o;null!=(o=t.next());){if(o==e&&!i){")"==e&&t.backUp(1);break}i=!i&&"\\"==o}return(o==e||!i&&")"!=e)&&(r.tokenize=null),n("string","string")}}function a(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=o(")"),n(null,"(")}function l(e,t,r){this.type=e,this.indent=t,this.prev=r}function s(e,t,r){return e.context=new l(r,t.indentation()+h,e.context),r}function u(e){return e.context=e.context.prev,e.context.type}function c(e,t,r){return S[r.context.type](e,t,r)}function d(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return c(e,t,r)}function f(e){var t=e.current().toLowerCase();L=w.hasOwnProperty(t)?"atom":b.hasOwnProperty(t)?"keyword":"variable"}r.propertyKeywords||(r=e.resolveMode("text/css"));var h=t.indentUnit,p=r.tokenHooks,m=r.mediaTypes||{},g=r.mediaFeatures||{},v=r.propertyKeywords||{},y=r.nonStandardPropertyKeywords||{},b=r.colorKeywords||{},w=r.valueKeywords||{},x=r.fontProperties||{},k=r.allowNested,C,L,S={};return S.top=function(e,t,r){if("{"==e)return s(r,t,"block");if("}"==e&&r.context.prev)return u(r);if("@media"==e)return s(r,t,"media");if("@font-face"==e)return"font_face_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return s(r,t,"at");if("hash"==e)L="builtin";else if("word"==e)L="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return s(r,t,"interpolation");if(":"==e)return"pseudo";if(k&&"("==e)return s(r,t,"params")}return r.context.type},S.block=function(e,t,r){if("word"==e){var n=t.current().toLowerCase();return v.hasOwnProperty(n)?(L="property","maybeprop"):y.hasOwnProperty(n)?(L="string-2","maybeprop"):k?(L=t.match(/^\s*:/,!1)?"property":"tag","block"):(L+=" error","maybeprop")}return"meta"==e?"block":k||"hash"!=e&&"qualifier"!=e?S.top(e,t,r):(L="error","block")},S.maybeprop=function(e,t,r){return":"==e?s(r,t,"prop"):c(e,t,r)},S.prop=function(e,t,r){if(";"==e)return u(r);if("{"==e&&k)return s(r,t,"propBlock");if("}"==e||"{"==e)return d(e,t,r);if("("==e)return s(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t.current())){if("word"==e)f(t);else if("interpolation"==e)return s(r,t,"interpolation")}else L+=" error";return"prop"},S.propBlock=function(e,t,r){return"}"==e?u(r):"word"==e?(L="property","maybeprop"):r.context.type},S.parens=function(e,t,r){return"{"==e||"}"==e?d(e,t,r):")"==e?u(r):"parens"},S.pseudo=function(e,t,r){return"word"==e?(L="variable-3",r.context.type):c(e,t,r)},S.media=function(e,t,r){if("("==e)return s(r,t,"media_parens");if("}"==e)return d(e,t,r);if("{"==e)return u(r)&&s(r,t,k?"block":"top");if("word"==e){var n=t.current().toLowerCase();L="only"==n||"not"==n||"and"==n?"keyword":m.hasOwnProperty(n)?"attribute":g.hasOwnProperty(n)?"property":"error"}return r.context.type},S.media_parens=function(e,t,r){return")"==e?u(r):"{"==e||"}"==e?d(e,t,r,2):S.media(e,t,r)},S.font_face_before=function(e,t,r){return"{"==e?s(r,t,"font_face"):c(e,t,r)},S.font_face=function(e,t,r){return"}"==e?u(r):"word"==e?(L=x.hasOwnProperty(t.current().toLowerCase())?"property":"error","maybeprop"):"font_face"},S.keyframes=function(e,t,r){return"word"==e?(L="variable","keyframes"):"{"==e?s(r,t,"top"):c(e,t,r)},S.at=function(e,t,r){return";"==e?u(r):"{"==e||"}"==e?d(e,t,r):("word"==e?L="tag":"hash"==e&&(L="builtin"),"at")},S.interpolation=function(e,t,r){return"}"==e?u(r):"{"==e||";"==e?d(e,t,r):("variable"!=e&&(L="error"),"interpolation")},S.params=function(e,t,r){return")"==e?u(r):"{"==e||"}"==e?d(e,t,r):("word"==e&&f(t),"params")},{startState:function(e){return{tokenize:null,state:"top",context:new l("top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||i)(e,t);return r&&"object"==typeof r&&(C=r[1],r=r[0]),L=r,t.state=S[t.state](C,e,t),L},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return"prop"==r.type&&"}"==n&&(r=r.prev),!r.prev||("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"font_face"!=r.type)&&(")"!=n||"parens"!=r.type&&"params"!=r.type&&"media_parens"!=r.type)&&("{"!=n||"at"!=r.type&&"media"!=r.type)||(i=r.indent-h,r=r.prev),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var i=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],o=t(i),a=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],l=t(a),s=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-inside","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],u=t(s),c=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],c=t(c),d=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],f=t(d),h=["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"],p=t(h),m=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],g=t(m),v=i.concat(a).concat(s).concat(c).concat(d).concat(h);e.registerHelper("hintWords","css",v),e.defineMIME("text/css",{mediaTypes:o,mediaFeatures:l,propertyKeywords:u,nonStandardPropertyKeywords:c,colorKeywords:f,valueKeywords:p,fontProperties:g,tokenHooks:{"<":function(e,t){return e.match("!--")?(t.tokenize=n,n(e,t)):!1},"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:o,mediaFeatures:l,propertyKeywords:u,nonStandardPropertyKeywords:c,colorKeywords:f,valueKeywords:p,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:o,mediaFeatures:l,propertyKeywords:u,nonStandardPropertyKeywords:c,colorKeywords:f,valueKeywords:p,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},"@":function(e){return e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("htmlmixed",function(t,r){function n(e,t){var r=t.htmlState.tagName,n=l.token(e,t.htmlState);if("script"==r&&/\btag\b/.test(n)&&">"==e.current()){var i=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);i=i?i[1]:"",i&&/[\"\']/.test(i.charAt(0))&&(i=i.slice(1,i.length-1));for(var c=0;c<u.length;++c){var d=u[c];if("string"==typeof d.matches?i==d.matches:d.matches.test(i)){d.mode&&(t.token=o,t.localMode=d.mode,t.localState=d.mode.startState&&d.mode.startState(l.indent(t.htmlState,"")));break}}}else"style"==r&&/\btag\b/.test(n)&&">"==e.current()&&(t.token=a,t.localMode=s,t.localState=s.startState(l.indent(t.htmlState,"")));return n}function i(e,t,r){var n=e.current(),i=n.search(t),o;return i>-1?e.backUp(n.length-i):(o=n.match(/<\/?$/))&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}function o(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=n,t.localState=t.localMode=null,n(e,t)):i(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function a(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=n,t.localState=t.localMode=null,n(e,t)):i(e,/<\/\s*style\s*>/,s.token(e,t.localState))}var l=e.getMode(t,{name:"xml",htmlMode:!0,multilineTagIndentFactor:r.multilineTagIndentFactor,multilineTagIndentPastTag:r.multilineTagIndentPastTag}),s=e.getMode(t,"css"),u=[],c=r&&r.scriptTypes;if(u.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:e.getMode(t,"javascript")}),c)for(var d=0;d<c.length;++d){var f=c[d];u.push({matches:f.matches,mode:f.mode&&e.getMode(t,f.mode)})}return u.push({matches:/./,mode:e.getMode(t,"text/plain")}),{startState:function(){var e=l.startState();return{token:n,localMode:null,localState:null,htmlState:e}},copyState:function(t){if(t.localState)var r=e.copyState(t.localMode,t.localState);return{token:t.token,localMode:t.localMode,localState:r,htmlState:e.copyState(l,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,r){return!t.localMode||/^\s*<\//.test(r)?l.indent(t.htmlState,r):t.localMode.indent?t.localMode.indent(t.localState,r):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||l}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("javascript",function(t,r){function n(e){for(var t=!1,r,n=!1;null!=(r=e.next());){if(!t){if("/"==r&&!n)return;"["==r?n=!0:n&&"]"==r&&(n=!1)}t=!t&&"\\"==r}}function i(e,t,r){return ke=e,Ce=r,t}function o(e,t){var r=e.next();if('"'==r||"'"==r)return t.tokenize=a(r),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return i("number","number");if("."==r&&e.match(".."))return i("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return i(r);if("="==r&&e.eat(">"))return i("=>","operator");if("0"==r&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),i("number","number");if(/\d/.test(r))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),i("number","number");if("/"==r)return e.eat("*")?(t.tokenize=l,l(e,t)):e.eat("/")?(e.skipToEnd(),i("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(n(e),e.eatWhile(/[gimy]/),i("regexp","string-2")):(e.eatWhile(we),i("operator","operator",e.current()));if("`"==r)return t.tokenize=s,s(e,t);if("#"==r)return e.skipToEnd(),i("error","error");if(we.test(r))return e.eatWhile(we),i("operator","operator",e.current());e.eatWhile(/[\w\$_]/);var o=e.current(),u=be.propertyIsEnumerable(o)&&be[o];return u&&"."!=t.lastType?i(u.type,u.style,o):i("variable","variable",o)}function a(e){return function(t,r){var n=!1,a;if(ge&&"@"==t.peek()&&t.match(xe))return r.tokenize=o,i("jsonld-keyword","meta");for(;null!=(a=t.next())&&(a!=e||n);)n=!n&&"\\"==a;return n||(r.tokenize=o),i("string","string")}}function l(e,t){for(var r=!1,n;n=e.next();){if("/"==n&&r){t.tokenize=o;break}r="*"==n}return i("comment","comment")}function s(e,t){for(var r=!1,n;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=o;break}r=!r&&"\\"==n}return i("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),l=Le.indexOf(a);if(l>=0&&3>l){if(!n){++o;break}if(0==--n)break}else if(l>=3&&6>l)++n;else if(/[$\w]/.test(a))i=!0;else if(i&&!n){++o;break}}i&&!n&&(t.fatArrowAt=o)}}function c(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function d(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function f(e,t,r,n,i){var o=e.cc;for(Me.state=e,Me.stream=i,Me.marked=null,Me.cc=o,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():ve?k:x;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Me.marked?Me.marked:"variable"==r&&d(e,n)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)Me.cc.push(arguments[e])}function p(){return h.apply(null,arguments),!0}function m(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var n=Me.state;if(n.context){if(Me.marked="def",t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;r.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function g(){Me.state.context={prev:Me.state.context,vars:Me.state.localVars},Me.state.localVars=Te}function v(){Me.state.localVars=Me.state.context.vars,Me.state.context=Me.state.context.prev}function y(e,t){var r=function(){var r=Me.state,n=r.indented;"stat"==r.lexical.type&&(n=r.lexical.indented),r.lexical=new c(n,Me.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function b(){var e=Me.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function w(e){function t(r){return r==e?p():";"==e?h():p(t)}return t}function x(e,t){return"var"==e?p(y("vardef",t.length),V,w(";"),b):"keyword a"==e?p(y("form"),k,x,b):"keyword b"==e?p(y("form"),x,b):"{"==e?p(y("}"),B,b):";"==e?p():"if"==e?("else"==Me.state.lexical.info&&Me.state.cc[Me.state.cc.length-1]==b&&Me.state.cc.pop()(),p(y("form"),k,x,b,Y)):"function"==e?p(te):"for"==e?p(y("form"),X,x,b):"variable"==e?p(y("stat"),E):"switch"==e?p(y("form"),k,y("}","switch"),w("{"),B,b,b):"case"==e?p(k,w(":")):"default"==e?p(w(":")):"catch"==e?p(y("form"),g,w("("),re,w(")"),x,b,v):"module"==e?p(y("form"),g,ae,v,b):"class"==e?p(y("form"),ne,oe,b):"export"==e?p(y("form"),le,b):"import"==e?p(y("form"),se,b):h(y("stat"),k,w(";"),b);
6
+ }function k(e){return L(e,!1)}function C(e){return L(e,!0)}function L(e,t){if(Me.state.fatArrowAt==Me.stream.start){var r=t?z:O;if("("==e)return p(g,y(")"),_(q,")"),b,w("=>"),r,v);if("variable"==e)return h(g,q,w("=>"),r,v)}var n=t?A:T;return Se.hasOwnProperty(e)?p(n):"function"==e?p(te,n):"keyword c"==e?p(t?M:S):"("==e?p(y(")"),S,he,w(")"),b,n):"operator"==e||"spread"==e?p(t?C:k):"["==e?p(y("]"),de,b,n):"{"==e?F(I,"}",null,n):"quasi"==e?h(N,n):p()}function S(e){return e.match(/[;\}\)\],]/)?h():h(k)}function M(e){return e.match(/[;\}\)\],]/)?h():h(C)}function T(e,t){return","==e?p(k):A(e,t,!1)}function A(e,t,r){var n=0==r?T:A,i=0==r?k:C;return"=>"==t?p(g,r?z:O,v):"operator"==e?/\+\+|--/.test(t)?p(n):"?"==t?p(k,w(":"),i):p(i):"quasi"==e?h(N,n):";"!=e?"("==e?F(C,")","call",n):"."==e?p(W,n):"["==e?p(y("]"),S,w("]"),b,n):void 0:void 0}function N(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?p(N):p(k,H)}function H(e){return"}"==e?(Me.marked="string-2",Me.state.tokenize=s,p(N)):void 0}function O(e){return u(Me.stream,Me.state),h("{"==e?x:k)}function z(e){return u(Me.stream,Me.state),h("{"==e?x:C)}function E(e){return":"==e?p(b,x):h(T,w(";"),b)}function W(e){return"variable"==e?(Me.marked="property",p()):void 0}function I(e,t){if("variable"==e){if(Me.marked="property","get"==t||"set"==t)return p(D)}else if("number"==e||"string"==e)Me.marked=ge?"property":e+" property";else if("["==e)return p(k,w("]"),P);return Se.hasOwnProperty(e)?p(P):void 0}function D(e){return"variable"!=e?h(P):(Me.marked="property",p(te))}function P(e){return":"==e?p(C):"("==e?h(te):void 0}function _(e,t){function r(n){if(","==n){var i=Me.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),p(e,r)}return n==t?p():p(w(t))}return function(n){return n==t?p():h(e,r)}}function F(e,t,r){for(var n=3;n<arguments.length;n++)Me.cc.push(arguments[n]);return p(y(t,r),_(e,t),b)}function B(e){return"}"==e?p():h(x,B)}function R(e){return ye&&":"==e?p(j):void 0}function j(e){return"variable"==e?(Me.marked="variable-3",p()):void 0}function V(){return h(q,R,U,K)}function q(e,t){return"variable"==e?(m(t),p()):"["==e?F(q,"]"):"{"==e?F(G,"}"):void 0}function G(e,t){return"variable"!=e||Me.stream.match(/^\s*:/,!1)?("variable"==e&&(Me.marked="property"),p(w(":"),q,U)):(m(t),p(U))}function U(e,t){return"="==t?p(C):void 0}function K(e){return","==e?p(V):void 0}function Y(e,t){return"keyword b"==e&&"else"==t?p(y("form","else"),x,b):void 0}function X(e){return"("==e?p(y(")"),Z,w(")"),b):void 0}function Z(e){return"var"==e?p(V,w(";"),J):";"==e?p(J):"variable"==e?p(Q):h(k,w(";"),J)}function Q(e,t){return"in"==t||"of"==t?(Me.marked="keyword",p(k)):p(T,J)}function J(e,t){return";"==e?p(ee):"in"==t||"of"==t?(Me.marked="keyword",p(k)):h(k,w(";"),ee)}function ee(e){")"!=e&&p(k)}function te(e,t){return"*"==t?(Me.marked="keyword",p(te)):"variable"==e?(m(t),p(te)):"("==e?p(g,y(")"),_(re,")"),b,x,v):void 0}function re(e){return"spread"==e?p(re):h(q,R)}function ne(e,t){return"variable"==e?(m(t),p(ie)):void 0}function ie(e,t){return"extends"==t?p(k):void 0}function oe(e){return"{"==e?F(I,"}"):void 0}function ae(e,t){return"string"==e?p(x):"variable"==e?(m(t),p(ce)):void 0}function le(e,t){return"*"==t?(Me.marked="keyword",p(ce,w(";"))):"default"==t?(Me.marked="keyword",p(k,w(";"))):h(x)}function se(e){return"string"==e?p():h(ue,ce)}function ue(e,t){return"{"==e?F(ue,"}"):("variable"==e&&m(t),p())}function ce(e,t){return"from"==t?(Me.marked="keyword",p(k)):void 0}function de(e){return"]"==e?p():h(C,fe)}function fe(e){return"for"==e?h(he,w("]")):","==e?p(_(C,"]")):h(_(C,"]"))}function he(e){return"for"==e?p(X,he):"if"==e?p(k,he):void 0}var pe=t.indentUnit,me=r.statementIndent,ge=r.jsonld,ve=r.json||ge,ye=r.typescript,be=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},a={"if":e("if"),"while":t,"with":t,"else":r,"do":r,"try":r,"finally":r,"return":n,"break":n,"continue":n,"new":n,"delete":n,"throw":n,"debugger":n,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":e("this"),module:e("module"),"class":e("class"),"super":e("atom"),"yield":n,"export":e("export"),"import":e("import"),"extends":n};if(ye){var l={type:"variable",style:"variable-3"},s={"interface":e("interface"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),string:l,number:l,bool:l,any:l};for(var u in s)a[u]=s[u]}return a}(),we=/[+\-*&%=<>!?|~^]/,xe=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,ke,Ce,Le="([{}])",Se={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Me={state:null,column:null,marked:null,cc:null},Te={name:"this",next:{name:"arguments"}};return b.lex=!0,{startState:function(e){var t={tokenize:o,lastType:"sof",cc:[],lexical:new c((e||0)-pe,0,"block",!1),localVars:r.localVars,context:r.localVars&&{vars:r.localVars},indented:0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=l&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==ke?r:(t.lastType="operator"!=ke||"++"!=Ce&&"--"!=Ce?ke:"incdec",f(t,r,ke,Ce,e))},indent:function(t,n){if(t.tokenize==l)return e.Pass;if(t.tokenize!=o)return 0;var i=n&&n.charAt(0),a=t.lexical;if(!/^\s*else\b/.test(n))for(var s=t.cc.length-1;s>=0;--s){var u=t.cc[s];if(u==b)a=a.prev;else if(u!=Y)break}"stat"==a.type&&"}"==i&&(a=a.prev),me&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var c=a.type,d=i==c;return"vardef"==c?a.indented+("operator"==t.lastType||","==t.lastType?a.info+1:0):"form"==c&&"{"==i?a.indented:"form"==c?a.indented+pe:"stat"==c?a.indented+("operator"==t.lastType||","==t.lastType?me||pe:0):"switch"!=a.info||d||0==r.doubleIndentSwitch?a.align?a.column+(d?0:1):a.indented+(d?0:pe):a.indented+(/^(?:case|default)\b/.test(n)?pe:2*pe)},electricChars:":{}",blockCommentStart:ve?null:"/*",blockCommentEnd:ve?null:"*/",lineComment:ve?null:"//",fold:"brace",helperType:ve?"json":"javascript",jsonldMode:ge,jsonMode:ve}}),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("xml",function(t,r){function n(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();if("<"==n)return e.eat("!")?e.eat("[")?e.match("CDATA[")?r(a("atom","]]>")):null:e.match("--")?r(a("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(l(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=a("meta","?>"),"meta"):(S=e.eat("/")?"closeTag":"openTag",t.tokenize=i,"tag bracket");if("&"==n){var o;return o=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),o?"atom":"error"}return e.eatWhile(/[^&<]/),null}function i(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=n,S=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return S="equals",null;if("<"==r){t.tokenize=n,t.state=d,t.tagName=t.tagStart=null;var i=t.tokenize(e,t);return i?i+" error":"error"}return/[\'\"]/.test(r)?(t.tokenize=o(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function o(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=i;break}return"string"};return t.isInAttribute=!0,t}function a(e,t){return function(r,i){for(;!r.eol();){if(r.match(t)){i.tokenize=n;break}r.next()}return e}}function l(e){return function(t,r){for(var i;null!=(i=t.next());){if("<"==i)return r.tokenize=l(e+1),r.tokenize(t,r);if(">"==i){if(1==e){r.tokenize=n;break}return r.tokenize=l(e-1),r.tokenize(t,r)}}return"meta"}}function s(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(C.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function u(e){e.context&&(e.context=e.context.prev)}function c(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!C.contextGrabbers.hasOwnProperty(r)||!C.contextGrabbers[r].hasOwnProperty(t))return;u(e)}}function d(e,t,r){return"openTag"==e?(r.tagStart=t.column(),f):"closeTag"==e?h:d}function f(e,t,r){return"word"==e?(r.tagName=t.current(),M="tag",g):(M="error",f)}function h(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&C.implicitlyClosed.hasOwnProperty(r.context.tagName)&&u(r),r.context&&r.context.tagName==n?(M="tag",p):(M="tag error",m)}return M="error",m}function p(e,t,r){return"endTag"!=e?(M="error",p):(u(r),d)}function m(e,t,r){return M="error",p(e,t,r)}function g(e,t,r){if("word"==e)return M="attribute",v;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||C.autoSelfClosers.hasOwnProperty(n)?c(r,n):(c(r,n),r.context=new s(r,n,i==r.indented)),d}return M="error",g}function v(e,t,r){return"equals"==e?y:(C.allowMissing||(M="error"),g(e,t,r))}function y(e,t,r){return"string"==e?b:"word"==e&&C.allowUnquoted?(M="string",g):(M="error",g(e,t,r))}function b(e,t,r){return"string"==e?b:g(e,t,r)}var w=t.indentUnit,x=r.multilineTagIndentFactor||1,k=r.multilineTagIndentPastTag;null==k&&(k=!0);var C=r.htmlMode?{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},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}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},L=r.alignCDATA,S,M;return{startState:function(){return{tokenize:n,state:d,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;S=null;var r=t.tokenize(e,t);return(r||S)&&"comment"!=r&&(M=null,t.state=t.state(S||r,e,t),M&&(r="error"==M?r+" error":M)),r},indent:function(t,r,o){var a=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+w;if(a&&a.noIndent)return e.Pass;if(t.tokenize!=i&&t.tokenize!=n)return o?o.match(/^(\s*)/)[0].length:0;if(t.tagName)return k?t.tagStart+t.tagName.length+2:t.tagStart+w*x;if(L&&/<!\[CDATA\[/.test(r))return 0;var l=r&&/^<(\/)?([\w_:\.-]*)/.exec(r);if(l&&l[1])for(;a;){if(a.tagName==l[2]){a=a.prev;break}if(!C.implicitlyClosed.hasOwnProperty(a.tagName))break;a=a.prev}else if(l)for(;a;){var s=C.contextGrabbers[a.tagName];if(!s||!s.hasOwnProperty(l[2]))break;a=a.prev}for(;a&&!a.startOfLine;)a=a.prev;return a?a.indent+w:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:r.htmlMode?"html":"xml",helperType:r.htmlMode?"html":"xml"}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",o),e.removeLineClass(e.state.activeLines[t],"background",a)}function r(e,t){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function n(e,n){for(var i=[],l=0;l<n.length;l++){var s=e.getLineHandleVisualStart(n[l].head.line);i[i.length-1]!=s&&i.push(s)}r(e.state.activeLines,i)||e.operation(function(){t(e);for(var r=0;r<i.length;r++)e.addLineClass(i[r],"wrap",o),e.addLineClass(i[r],"background",a);e.state.activeLines=i})}function i(e,t){n(e,t.ranges)}var o="CodeMirror-activeline",a="CodeMirror-activeline-background";e.defineOption("styleActiveLine",!1,function(r,o,a){var l=a&&a!=e.Init;o&&!l?(r.state.activeLines=[],n(r,r.listSelections()),r.on("beforeSelectionChange",i)):!o&&l&&(r.off("beforeSelectionChange",i),t(r),delete r.state.activeLines)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n,i){var o=e.getLineHandle(t.line),s=t.ch-1,u=s>=0&&l[o.text.charAt(s)]||l[o.text.charAt(++s)];if(!u)return null;var c=">"==u.charAt(1)?1:-1;if(n&&c>0!=(s==t.ch))return null;var d=e.getTokenTypeAt(a(t.line,s+1)),f=r(e,a(t.line,s+(c>0?1:0)),c,d||null,i);return null==f?null:{from:a(t.line,s),to:f&&f.pos,match:f&&f.ch==u.charAt(0),forward:c>0}}function r(e,t,r,n,i){for(var o=i&&i.maxScanLineLength||1e4,s=i&&i.maxScanLines||1e3,u=[],c=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,d=r>0?Math.min(t.line+s,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-s),f=t.line;f!=d;f+=r){var h=e.getLine(f);if(h){var p=r>0?0:h.length-1,m=r>0?h.length:-1;if(!(h.length>o))for(f==t.line&&(p=t.ch-(0>r?1:0));p!=m;p+=r){var g=h.charAt(p);if(c.test(g)&&(void 0===n||e.getTokenTypeAt(a(f,p+1))==n)){var v=l[g];if(">"==v.charAt(1)==r>0)u.push(g);else{if(!u.length)return{pos:a(f,p),ch:g};u.pop()}}}}}return f-r==(r>0?e.lastLine():e.firstLine())?!1:null}function n(e,r,n){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,l=[],s=e.listSelections(),u=0;u<s.length;u++){var c=s[u].empty()&&t(e,s[u].head,!1,n);if(c&&e.getLine(c.from.line).length<=i){var d=c.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";l.push(e.markText(c.from,a(c.from.line,c.from.ch+1),{className:d})),c.to&&e.getLine(c.to.line).length<=i&&l.push(e.markText(c.to,a(c.to.line,c.to.ch+1),{className:d}))}}if(l.length){o&&e.state.focused&&e.display.input.focus();var f=function(){e.operation(function(){for(var e=0;e<l.length;e++)l[e].clear()})};if(!r)return f;setTimeout(f,800)}}function i(e){e.operation(function(){s&&(s(),s=null),s=n(e,!1,e.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),a=e.Pos,l={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},s=null;e.defineOption("matchBrackets",!1,function(t,r,n){n&&n!=e.Init&&t.off("cursorActivity",i),r&&(t.state.matchBrackets="object"==typeof r?r:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){n(this,!0)}),e.defineExtension("findMatchingBracket",function(e,r,n){return t(this,e,r,n)}),e.defineExtension("scanForBracket",function(e,t,n,i){return r(this,e,t,n,i)})}),window.onload=heshPlugin;
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: nixdns
3
  Donate link: https://www.paypal.me/mukhortov/5
4
  Tags: html editor, syntax highlighter, plugin editor, syntax, highlighting, syntax highlighting, text editor, editor, text editor syntax, editor, editor syntax
5
  Requires at least: 3.3
6
- Tested up to: 4.3
7
- Stable tag: 1.6.8
8
 
9
  Add syntax highlighting to the HTML editor.
10
 
@@ -21,8 +21,7 @@ Add syntax highlighting to the HTML editor.
21
  * New fullscreen mode.
22
  * Toggle fullscreen mode with F11/Esc hotkeys
23
 
24
- If you like the plugin, don’t hesitate to support me and leave a review :)
25
-
26
 
27
  == Installation ==
28
 
@@ -31,7 +30,7 @@ If you like the plugin, don’t hesitate to support me and leave a review :)
31
 
32
  == Changelog ==
33
 
34
- = 1.6.8 =
35
  * Fixed issues with switching editor modes in WP 4.3
36
 
37
  = 1.6.7 =
3
  Donate link: https://www.paypal.me/mukhortov/5
4
  Tags: html editor, syntax highlighter, plugin editor, syntax, highlighting, syntax highlighting, text editor, editor, text editor syntax, editor, editor syntax
5
  Requires at least: 3.3
6
+ Tested up to: 4.3.1
7
+ Stable tag: 1.6.9
8
 
9
  Add syntax highlighting to the HTML editor.
10
 
21
  * New fullscreen mode.
22
  * Toggle fullscreen mode with F11/Esc hotkeys
23
 
24
+ If you like the plugin, please [donate](https://www.paypal.me/mukhortov/5) and leave a review :)
 
25
 
26
  == Installation ==
27
 
30
 
31
  == Changelog ==
32
 
33
+ = 1.6.9 =
34
  * Fixed issues with switching editor modes in WP 4.3
35
 
36
  = 1.6.7 =