!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";var f=/gecko\/\d/i.test(navigator.userAgent),e=/MSIE \d/.test(navigator.userAgent),t=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),v=e||t,y=v&&(e?document.documentMode||6:t[1]),d=/WebKit\//.test(navigator.userAgent),n=d&&/Qt\/\d+\.\d+/.test(navigator.userAgent),r=/Chrome\//.test(navigator.userAgent),p=/Opera\//.test(navigator.userAgent),a=/Apple Computer/.test(navigator.vendor),i=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),u=/PhantomJS/.test(navigator.userAgent),l=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),s=l||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),g=l||/Mac/.test(navigator.platform),e=/win/i.test(navigator.platform),t=p&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);(t=t&&Number(t[1]))&&15<=t&&(d=!(p=!1));var o=g&&(n||p&&(null==t||t<12.11)),m=f||v&&9<=y,c=!1,h=!1;function b(e,t){if(!(this instanceof b))return new b(e,t);this.options=t=t?_i(t):{},_i(Pn,t,!1),O(t);var n=t.value;"string"==typeof n&&(n=new Xr(n,t.mode,null,t.lineSeparator)),this.doc=n;var r=new b.inputStyles[t.inputStyle](this),r=this.display=new w(e,n,r);M(r.wrapper.CodeMirror=this),T(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),t.autofocus&&!s&&r.input.focus(),E(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Ii,keySeq:null,specialChars:null};var i,o=this;for(i in v&&y<11&&setTimeout(function(){o.display.input.reset(!0)},20),function(i){var r=i.display;xi(r.scroller,"mousedown",Wt(i,Kt)),xi(r.scroller,"dblclick",v&&y<11?Wt(i,function(e){var t;Mi(i,e)||(!(t=Vt(i,e))||Xt(i,e)||Ut(i.display,e)||(gi(e),t=i.findWordAt(t),Oe(i.doc,t.anchor,t.head)))}):function(e){Mi(i,e)||gi(e)});m||xi(r.scroller,"contextmenu",function(e){dn(i,e)});var n,o={end:0};function l(){r.activeTouch&&(n=setTimeout(function(){r.activeTouch=null},1e3),(o=r.activeTouch).end=+new Date)}function s(e,t){if(null==t.left)return 1;var n=t.left-e.left,e=t.top-e.top;return 400n.maxLineLength&&(n.maxLineLength=t,n.maxLine=e)})}function O(e){var t=Vi(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):-1=r&&(o=ni(t,ri(Zr(t,n))-e.wrapper.clientHeight),r=n)),{from:o,to:Math.max(r,o+1)}}function R(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=U(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",l=0;l=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Bt(e))return!1;B(e)&&(zt(e),t.dims=q(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroml&&n.viewTo-l<20&&(l=Math.min(i,n.viewTo)),h&&(o=br(e.doc,o),l=wr(e.doc,l));i=o!=n.viewFrom||l!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;!function(e,t,n){var r=e.display;0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=Pt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Pt(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Ft(e,n))));r.viewTo=n}(e,o,l),n.viewOffset=ri(Zr(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";o=Bt(e);if(!i&&0==o&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;l=lo();return 4=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&K(e,t);r=!1){Y(e);var i=D(e);Ue(e),_(e,i),I(e,i)}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function X(e,t){var n=new V(e,t);K(e,n)&&(Y(e),j(e,n),t=D(e),Ue(e),_(e,t),I(e,t),n.finish())}function _(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var n=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=n+"px",e.display.gutters.style.height=Math.max(n+Qe(e),t.clientHeight)+"px"}function Y(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;re.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;return r?(this.vert.style.display="block",this.vert.style.bottom=n?i+"px":"0",t=e.viewHeight-(n?i:0),this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+t)+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0"),n?(this.horiz.style.display="block",this.horiz.style.right=r?i+"px":"0",this.horiz.style.left=e.barLeft+"px",t=e.viewWidth-e.barLeft-(r?i:0),this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+t+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedOverlay&&0n?ie(n,Zr(e,n).text.length):(e=Zr(e,(n=t).line).text.length,null==(t=n.ch)||e=e.first&&t=o.ch:u.to>o.ch))){if(r&&(Si(c,"beforeCursorEnter"),c.explicitlyCleared)){if(s.markedSpans){--a;continue}break}if(c.atomic){c=c.find(l<0?-1:1);if(0==oe(c,o)&&(c.ch+=l,c.ch<0?c=c.line>e.first?Ne(e,ie(c.line-1)):null:c.ch>s.text.length&&(c=c.linet||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),1==l.level?"rtl":"ltr"),i=!0)}i||r(t,n,"ltr")}(ii(r),s||0,null==a?h:a,function(e,t,n){var r,i,o,l=f(e,"left");e==t?r=i=(o=l).left:(o=f(t-1,"right"),"rtl"==n&&(n=l,l=o,o=n),r=l.left,i=o.right),null==s&&0==e&&(r=d),3c.bottom||o.bottom==c.bottom&&o.right>c.right)&&(c=o),g(r=r=s.display.viewTo||(a=+new Date+s.options.workTime,u=Vn(h.mode,Ye(s,h.frontier)),c=[],h.iter(h.frontier,Math.min(h.first+h.size,s.display.viewTo+500),function(e){if(h.frontier>=s.display.viewFrom){var t=e.styles,n=e.text.length>s.options.maxHighlightLength,r=Or(s,e,n?Vn(h.mode,u):u,!0);e.styles=r.styles;var i=e.styleClasses,r=r.classes;r?e.styleClasses=r:i&&(e.styleClasses=null);for(var o=!t||t.length!=e.styles.length||i!=r&&(!i||!r||i.bgClass!=r.bgClass||i.textClass!=r.textClass),l=0;!o&&la)return Xe(s,s.options.workDelay),!0}),c.length&&At(s,function(){for(var e=0;ei.first&&Zr(i,l-1).stateAfter)?Vn(i.mode,s):Kn(i.mode);return i.iter(l,r,function(e){Hr(n,e.text,s);var t=l==r-1||l%5==0||l>=o.viewFrom&&ln)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function nt(e,t,n,r){return ot(e,it(e,t),n,r)}function rt(e,t){if(t>=e.display.viewFrom&&t=e.lineN&&tn.viewTo-1)return!1;m=i.line==n.viewFrom||0==(m=Ft(t,i.line))?(e=ti(n.view[0].line),n.view[0].node):(e=ti(n.view[m].line),n.view[m-1].node.nextSibling);var o,r=Ft(t,r.line);r=r==n.view.length-1?(o=n.viewTo-1,n.lineDiv.lastChild):(o=ti(n.view[r+1].line)-1,n.view[r+1].node.previousSibling);for(var l=t.doc.splitLines(function(l,e,t,s,a){var u="",c=!1,h=l.doc.lineSeparator();for(;!function e(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(null!=n)return""==n&&(n=t.textContent.replace(/\u200b/g,"")),void(u+=n);if(n=t.getAttribute("cm-marker"))(n=l.findMarks(ie(s,0),ie(a+1,0),(o=+n,function(e){return e.id==o}))).length&&(i=n[0].find())&&(u+=Qr(l.doc,i.from,i.to).join(h));else if("false"!=t.getAttribute("contenteditable")){for(var r=0;rt)&&(i=(o=u-a)-1,u<=t&&(l="right")),null!=i){if(r=e[s+2],a==u&&n==(r.insertLeft?"left":"right")&&(l=n),"left"==n&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)r=e[2+(s-=3)],l="left";if("right"==n&&i==u-a)for(;sn.from?s(e-1):s(e,r)}i=i||Zr(n.doc,e.line),o=o||it(n,i);var a=ii(i),u=e.ch;if(!a)return s(u);e=t(u,Ao(a,u));return null!=xo&&(e.other=t(u,xo)),e}function yt(e,t){var n=0,t=Ne(e.doc,t);e.options.lineWrapping||(n=Ct(e.display)*t.ch);t=Zr(e.doc,t.line),e=ri(t)+$e(e.display);return{left:n,right:n,top:e,bottom:e+t.height}}function bt(e,t,n,r){t=ie(e,t);return t.xRel=r,n&&(t.outside=!0),t}function wt(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return bt(r.first,0,!0,-1);var i=ni(r,n),o=r.first+r.size-1;if(oe.bottom?e.left-s:ou.from.ch||s.ch==u.from.ch&&0=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new V(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}(t[n]);for(n=0;n(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null==i||u||(t=to("div","​",null,"position: absolute; top: "+(t.top-n.viewOffset-$e(e.display))+"px; height: "+(t.bottom-t.top+Qe(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;"),e.display.lineSpace.appendChild(t),t.scrollIntoView(i),e.display.lineSpace.removeChild(t)))}(t,i))}var o=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(o)for(var s=0;st)&&(l.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=l.viewTo?h&&br(e.doc,t)l.viewFrom?zt(e):(l.viewFrom+=r,l.viewTo+=r):t<=l.viewFrom&&n>=l.viewTo?zt(e):t<=l.viewFrom?(o=Rt(e,n,n+r,1))?(l.view=l.view.slice(o.index),l.viewFrom=o.lineN,l.viewTo+=r):zt(e):n>=l.viewTo?(o=Rt(e,t,t,-1))?(l.view=l.view.slice(0,o.index),l.viewTo=o.lineN):zt(e):(i=Rt(e,t,t,-1),o=Rt(e,n,n+r,1),i&&o?(l.view=l.view.slice(0,i.index).concat(Pt(e,i.lineN,o.lineN)).concat(l.view.slice(o.index)),l.viewTo+=r):zt(e));e=l.externalMeasured;e&&(n=i.lineN&&t=r.viewTo||(null==(t=r.view[Ft(e,t)]).node||-1==Vi(t=t.changes||(t.changes=[]),n)&&t.push(n))}function zt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ft(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;ri-400&&0==oe(Lt.pos,n)?r="triple":St&&St.time>i-400&&0==oe(St.pos,n)?(r="double",Lt={time:i,pos:n}):(r="single",St={time:i,pos:n});var o,l=e.doc.sel,i=g?t.metaKey:t.ctrlKey;e.options.dragDrop&&mo&&!ce(e)&&"single"==r&&-1<(o=l.contains(n))&&(oe((o=l.ranges[o]).from(),n)<0||0c&&t.push(new Le(ie(s,c),ie(s,Fi(u,l,n))))}t.length||t.push(new Le(d,d)),Ie(g,Te(y.ranges.slice(0,v).concat(t),v),{origin:"*mouse",scroll:!1}),f.scrollIntoView(e)}else{var h=m,r=h.anchor,i=e;"single"!=p&&(e="double"==p?f.findWordAt(e):new Le(ie(e.line,0),Ne(g,ie(e.line+1,0))),r=0=t.to||i.linel.bottom?20:0)&&setTimeout(Wt(f,function(){s==r&&(o.scroller.scrollTop+=n,a(e))}),50))}function i(e){f.state.selectingText=!1,s=1/0,gi(e),o.input.focus(),Ci(document,"mousemove",u),Ci(document,"mouseup",c),g.history.lastSelOrigin=null}var u=Wt(f,function(e){(wi(e)?a:i)(e)}),c=Wt(f,i);f.state.selectingText=c,xi(document,"mousemove",u),xi(document,"mouseup",c)}(e,t,n,r,i)}(t,e,i):bi(e)==n.scroller&&gi(e);break;case 2:d&&(t.state.lastMiddleDown=+new Date),i&&Oe(t.doc,i),setTimeout(function(){n.input.focus()},20),gi(e);break;case 3:m?dn(t,e):((r=t).state.delayingBlurEvent=!0,setTimeout(function(){r.state.delayingBlurEvent&&(r.state.delayingBlurEvent=!1,fn(r))},100))}}}function jt(e,t,n,r,i){try{var o=t.clientX,l=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&gi(t);var s=e.display,r=s.lineDiv.getBoundingClientRect();if(l>r.bottom||!Ai(e,n))return vi(t);l-=r.top-s.viewOffset;for(var a=0;a=o)return i(e,n,e,ni(e.doc,l),e.options.gutters[a],t),vi(t)}}function Xt(e,t){return jt(e,t,"gutterClick",!0,Ti)}var _t=0;function Yt(e){var r=this;if($t(r),!Mi(r,e)&&!Ut(r.display,e)){gi(e),v&&(_t=+new Date);var t,i=Vt(r,e,!0),n=e.dataTransfer.files;if(i&&!ce(r))if(n&&n.length&&window.FileReader&&window.File)for(var o=n.length,l=Array(o),s=0,a=0;aa.clientWidth||l&&a.scrollHeight>a.clientHeight){if(l&&g&&d)e:for(var u=t.target,c=s.view;u!=a;u=u.parentNode)for(var h=0;he.lastLine()||(t.from.linei?{from:t.from,to:ie(i,Zr(e,i).text.length),text:[t.text[0]],origin:t.origin}:t).removed=Qr(e,t.from,t.to),n=n||mn(e,t),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,l=t.to,s=!1,a=o.line;e.options.lineWrapping||(a=ti(yr(Zr(r,o.line))),r.iter(a,l.line+1,function(e){if(e==i.maxLine)return s=!0}));-1i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0));r.frontier=Math.min(r.frontier,o.line),Xe(e,400);a=t.text.length-(l.line-o.line)-1;t.full?Et(e):o.line!=l.line||1!=t.text.length||Gr(e.doc,t)?Et(e,o.line,l.line+1,a):It(e,o.line,"text");r=Ai(e,"changes"),a=Ai(e,"change");(a||r)&&(t={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin},a&&Ti(e,"change",e,t),r&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(t));e.display.selForContextMenu=null}(e.cm,t,r):Ur(e,t,r),ze(e,n,Hi))}function Ln(e,t,n,r,i){var o;oe(r=r||n,n)<0&&(o=r,r=n,n=o),"string"==typeof t&&(t=e.splitLines(t)),bn(e,{from:n,to:r,text:t,origin:i})}function Tn(e,t,n,r,i){var o=e.display,l=xt(e.display),s=(e.curOp&&null!=e.curOp.scrollTop?e.curOp:o.scroller).scrollTop,a=et(e),u={},c=e.doc.height+qe(o),h=c-l<(i=ao.first?zi(Zr(o,t-1).text,null,l):0:"add"==n?c=a+e.options.indentUnit:"subtract"==n?c=a-e.options.indentUnit:"number"==typeof n&&(c=a+n);var c=Math.max(0,c),h="",f=0;if(e.options.indentWithTabs)for(var d=Math.floor(c/l);d;--d)f+=l,h+="\t";if(f=n.first+n.size?u=!1:a=Zr(n,o=e)))return u=!1;l=i?(r<0?ko:To)(a):r<0?a.text.length:0}else l=t;return 1}if("char"==t)c();else if("column"==t)c(!0);else if("word"==t||"group"==t)for(var h=null,f="group"==t,d=n.cm&&n.cm.getHelper(e,"wordChars"),p=!0;!(r<0)||c(!p);p=!1){var g=a.text.charAt(l)||"\n",g=Zi(g,d)?"w":f&&"\n"==g?"n":!f||/\s/.test(g)?null:"p";if(!f||p||g||(g="s"),h&&h!=g){r<0&&(r=1,c());break}if(g&&(h=g),0=l.height){a.hitSide=!0;break}o+=5*n}return a}b.prototype={constructor:b,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];n[e]==t&&"mode"!=e||(n[e]=t,En.hasOwnProperty(e)&&Wt(this,En[e])(this,t,r))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Zn(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(An(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Mn(this));else{for(var o=i.from(),l=i.to(),i=Math.max(n,o.line),n=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1,s=i;s>1;if((l?n[2*l-1]:0)>=o)i=l;else{if(!(n[2*l+1]o)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=o&&(a=e.bottom),u+t.offsetWidth>l&&(u=l-t.offsetWidth)),t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(u=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),n&&(i=this,s=a,u=(n=u)+t.offsetWidth,t=a+t.offsetHeight,null!=(t=Tn(i,n,s,u,t)).scrollTop&&qt(i,t.scrollTop),null!=t.scrollLeft&&Zt(i,t.scrollLeft))},triggerOnKeyDown:Ot(an),triggerOnKeyPress:Ot(cn),triggerOnKeyUp:un,execCommand:function(e){if(jn.hasOwnProperty(e))return jn[e].call(null,this)},triggerElectric:Ot(function(e){pe(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=0,l=Ne(this.doc,e);ol.doc.first&&((r=Zr(l.doc,i.line-1).text)&&l.replaceRange(o.charAt(0)+l.doc.lineSeparator()+r.charAt(r.length-1),ie(i.line-1,r.length-1),ie(i.line,1),"+transpose"))),t.push(new Le(i,i))}l.setSelections(t)})},newlineAndIndent:function(r){At(r,function(){for(var e=r.listSelections().length,t=0;t=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.post},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){e=this.string.indexOf(e,this.pos);if(-1t.display.maxLineLength&&(t.display.maxLine=a,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&Et(t,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Re(t.doc)),t&&Ti(t,"markerCleared",t,this),n&&Nt(t),this.parent&&this.parent.clear()}},er.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i=t:l.to>t),(r=r||[]).push(new ir(s,l.from,o?null:l.to)))}return r}(n,i,e),s=function(e,t,n){if(e)for(var r,i=0;i=t:l.to>t))&&(l.from!=t||"bookmark"!=s.type||n&&!l.marker.insertLeft)||(o=null==l.from||(s.inclusiveLeft?l.from<=t:l.frome.lastLine())return t;var n,r=Zr(e,t);if(!xr(e,r))return t;for(;n=mr(r);)r=n.find(1,!0).line;return ti(r)+1}function xr(e,t){var n=h&&t.markedSpans;if(n)for(var r,i=0;it.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}function Ar(e,t,n,r){function i(e){return{start:h.start,end:h.pos,string:h.current(),type:o||null,state:e?Vn(l.mode,c):c}}var o,l=e.doc,s=l.mode;t=Ne(l,t);var a,u=Zr(l,t.line),c=Ye(e,t.line,n),h=new Qn(u.text,e.options.tabSize);for(r&&(a=[]);(r||h.pose.options.maxHighlightLength?(s=!1,l&&Hr(e,t,r,c.pos),c.pos=t.length,null):kr(Nr(n,c,r,h),o);if(!h||(f=h[0].name)&&(d="m-"+(d?f+" "+d:f)),!s||u!=d){for(;ae.options.maxHighlightLength?Vn(e.doc.mode,r):r),t.stateAfter=r,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++),t.styles}function Hr(e,t,n,r){var i=e.doc.mode,o=new Qn(t,e.options.tabSize);for(o.start=o.pos=r||0,""==t&&Mr(i,n);!o.eol();)Nr(i,o,n),o.start=o.pos}Wi(Tr),Tr.prototype.lineNo=function(){return ti(this)};var Pr={},Er={};function Ir(e,t){if(!e||/^\s*$/.test(e))return null;t=t.addModeClass?Er:Pr;return t[e]||(t[e]=e.replace(/\S+/g,"cm-$&"))}function zr(e,t){var n=to("span",null,null,d?"padding-right: .1px":null),r={pre:to("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,splitSpaces:(v||d)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,l=i?t.rest[i-1]:t.line;r.pos=0,r.addToken=Fr,function(e){if(null!=go)return go;var t=ro(e,document.createTextNode("AخA")),e=io(t,0,1).getBoundingClientRect();if(!e||e.left==e.right)return!1;t=io(t,1,2).getBoundingClientRect();return go=t.right-e.right<3}(e.display.measure)&&(o=ii(l))&&(r.addToken=function(h,f){return function(e,t,n,r,i,o,l){n=n?n+" cm-force-border":"cm-force-border";for(var s=e.pos,a=s+t.length;;){for(var u=0;us&&c.from<=s)break}if(c.to>=a)return h(e,t,n,r,i,o,l);h(e,t.slice(0,c.to-s),n,r,null,o,l),r=null,t=t.slice(c.to-s),s=c.to}}}(r.addToken,o)),r.map=[],function(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var l,s,a,u,c,h,f,d=i.length,p=0,g=1,m="",v=0;;){if(v==p){a=u=c=h=s="",f=null,v=1/0;for(var y=[],b=0;bp||x.collapsed&&w.to==p&&w.from==p)?(null!=w.to&&w.to!=p&&v>w.to&&(v=w.to,u=""),x.className&&(a+=" "+x.className),x.css&&(s=x.css),x.startStyle&&w.from==p&&(c+=" "+x.startStyle),x.endStyle&&w.to==v&&(u+=" "+x.endStyle),x.title&&!h&&(h=x.title),x.collapsed&&(!f||dr(f.marker,x)<0)&&(f=w)):w.from>p&&v>w.from&&(v=w.from)}if(f&&(f.from||0)==p){if(Br(t,(null==f.to?d+1:f.to)-p,f.marker,null==f.from),null==f.to)return;f.to==p&&(f=!1)}if(!f&&y.length)for(b=0;b=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(i,o,l){i=Ne(this,i),o=Ne(this,o);var s=[],a=i.line;return this.iter(i.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var n=0;nr.to||null==r.from&&a!=i.line||a==o.line&&r.from>o.ch||l&&!l(r.marker)||s.push(r.marker.parent||r.marker)}++a}),s},getAllMarks:function(){var r=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var n=0;nt&&(t=e.from),null!=e.to&&e.to=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(tl-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=(a=i).lastOp==r?(si(a.done),Gi(a.done)):a.done.length&&!Gi(a.done).ranges?Gi(a.done):1i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,s||Si(e,"historyAdded")}function ui(e,t){var n=Gi(t);n&&n.ranges&&n.equals(e)||t.push(e)}function ci(t,n,e,r){var i=n["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,r),function(e){e.markedSpans&&((i=i||(n["spans_"+t.id]={}))[o]=e.markedSpans),++o})}function hi(e,t,n){for(var r=0,i=[];rt)return l;if(s.from==t||s.to==t){if(null!=n)return r=e,i=s.level,o=e[n].level,r=r[0].level,i==r||o!=r&&il.from&&se.text.length?null:i}b.keyNames=Co,function(){for(var e=0;e<10;e++)Co[e+48]=Co[e+96]=String(e);for(e=65;e<=90;e++)Co[e]=String.fromCharCode(e);for(e=1;e<=12;e++)Co[e+111]=Co[e+63235]="F"+e}();var Ho,Po,Eo,Io,zo,Fo=(Ho=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,Po=/[stwN]/,Eo=/[LRr]/,Io=/[Lb1n]/,zo=/[1n]/,function(e){if(!Ho.test(e))return!1;for(var t,n=e.length,r=[],i=0;i*\/]/.test(ch)) { return ret(null, "select-op"); } else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) { return ret("qualifier", "qualifier"); } else if (/[:;{}\[\]\(\)]/.test(ch)) { return ret(null, ch); } else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) || (ch == "d" && stream.match("omain(")) || (ch == "r" && stream.match("egexp("))) { stream.backUp(1); state.tokenize = tokenParenthesized; return ret("property", "word"); } else if (/[\w\\\-]/.test(ch)) { stream.eatWhile(/[\w\\\-]/); return ret("property", "word"); } else { return ret(null, null); } } function tokenString(quote) { return function(stream, state) { var escaped = false, ch; while ((ch = stream.next()) != null) { if (ch == quote && !escaped) { if (quote == ")") stream.backUp(1); break; } escaped = !escaped && ch == "\\"; } if (ch == quote || !escaped && quote != ")") state.tokenize = null; return ret("string", "string"); }; } function tokenParenthesized(stream, state) { stream.next(); // Must be '(' if (!stream.match(/\s*[\"\')]/, false)) state.tokenize = tokenString(")"); else state.tokenize = null; return ret(null, "("); } // Context management function Context(type, indent, prev) { this.type = type; this.indent = indent; this.prev = prev; } function pushContext(state, stream, type) { state.context = new Context(type, stream.indentation() + indentUnit, state.context); return type; } function popContext(state) { state.context = state.context.prev; return state.context.type; } function pass(type, stream, state) { return states[state.context.type](type, stream, state); } function popAndPass(type, stream, state, n) { for (var i = n || 1; i > 0; i--) state.context = state.context.prev; return pass(type, stream, state); } // Parser function wordAsValue(stream) { var word = stream.current().toLowerCase(); if (valueKeywords.hasOwnProperty(word)) override = "atom"; else if (colorKeywords.hasOwnProperty(word)) override = "keyword"; else override = "variable"; } var states = {}; states.top = function(type, stream, state) { if (type == "{") { return pushContext(state, stream, "block"); } else if (type == "}" && state.context.prev) { return popContext(state); } else if (/@(media|supports|(-moz-)?document)/.test(type)) { return pushContext(state, stream, "atBlock"); } else if (/@(font-face|counter-style)/.test(type)) { state.stateArg = type; return "restricted_atBlock_before"; } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) { return "keyframes"; } else if (type && type.charAt(0) == "@") { return pushContext(state, stream, "at"); } else if (type == "hash") { override = "builtin"; } else if (type == "word") { override = "tag"; } else if (type == "variable-definition") { return "maybeprop"; } else if (type == "interpolation") { return pushContext(state, stream, "interpolation"); } else if (type == ":") { return "pseudo"; } else if (allowNested && type == "(") { return pushContext(state, stream, "parens"); } return state.context.type; }; states.block = function(type, stream, state) { if (type == "word") { var word = stream.current().toLowerCase(); if (propertyKeywords.hasOwnProperty(word)) { override = "property"; return "maybeprop"; } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) { override = "string-2"; return "maybeprop"; } else if (allowNested) { override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag"; return "block"; } else { override += " error"; return "maybeprop"; } } else if (type == "meta") { return "block"; } else if (!allowNested && (type == "hash" || type == "qualifier")) { override = "error"; return "block"; } else { return states.top(type, stream, state); } }; states.maybeprop = function(type, stream, state) { if (type == ":") return pushContext(state, stream, "prop"); return pass(type, stream, state); }; states.prop = function(type, stream, state) { if (type == ";") return popContext(state); if (type == "{" && allowNested) return pushContext(state, stream, "propBlock"); if (type == "}" || type == "{") return popAndPass(type, stream, state); if (type == "(") return pushContext(state, stream, "parens"); if (type == "hash" && !/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) { override += " error"; } else if (type == "word") { wordAsValue(stream); } else if (type == "interpolation") { return pushContext(state, stream, "interpolation"); } return "prop"; }; states.propBlock = function(type, _stream, state) { if (type == "}") return popContext(state); if (type == "word") { override = "property"; return "maybeprop"; } return state.context.type; }; states.parens = function(type, stream, state) { if (type == "{" || type == "}") return popAndPass(type, stream, state); if (type == ")") return popContext(state); if (type == "(") return pushContext(state, stream, "parens"); if (type == "interpolation") return pushContext(state, stream, "interpolation"); if (type == "word") wordAsValue(stream); return "parens"; }; states.pseudo = function(type, stream, state) { if (type == "word") { override = "variable-3"; return state.context.type; } return pass(type, stream, state); }; states.atBlock = function(type, stream, state) { if (type == "(") return pushContext(state, stream, "atBlock_parens"); if (type == "}") return popAndPass(type, stream, state); if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top"); if (type == "word") { var word = stream.current().toLowerCase(); if (word == "only" || word == "not" || word == "and" || word == "or") override = "keyword"; else if (documentTypes.hasOwnProperty(word)) override = "tag"; else if (mediaTypes.hasOwnProperty(word)) override = "attribute"; else if (mediaFeatures.hasOwnProperty(word)) override = "property"; else if (mediaValueKeywords.hasOwnProperty(word)) override = "keyword"; else if (propertyKeywords.hasOwnProperty(word)) override = "property"; else if (nonStandardPropertyKeywords.hasOwnProperty(word)) override = "string-2"; else if (valueKeywords.hasOwnProperty(word)) override = "atom"; else if (colorKeywords.hasOwnProperty(word)) override = "keyword"; else override = "error"; } return state.context.type; }; states.atBlock_parens = function(type, stream, state) { if (type == ")") return popContext(state); if (type == "{" || type == "}") return popAndPass(type, stream, state, 2); return states.atBlock(type, stream, state); }; states.restricted_atBlock_before = function(type, stream, state) { if (type == "{") return pushContext(state, stream, "restricted_atBlock"); if (type == "word" && state.stateArg == "@counter-style") { override = "variable"; return "restricted_atBlock_before"; } return pass(type, stream, state); }; states.restricted_atBlock = function(type, stream, state) { if (type == "}") { state.stateArg = null; return popContext(state); } if (type == "word") { if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) || (state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase()))) override = "error"; else override = "property"; return "maybeprop"; } return "restricted_atBlock"; }; states.keyframes = function(type, stream, state) { if (type == "word") { override = "variable"; return "keyframes"; } if (type == "{") return pushContext(state, stream, "top"); return pass(type, stream, state); }; states.at = function(type, stream, state) { if (type == ";") return popContext(state); if (type == "{" || type == "}") return popAndPass(type, stream, state); if (type == "word") override = "tag"; else if (type == "hash") override = "builtin"; return "at"; }; states.interpolation = function(type, stream, state) { if (type == "}") return popContext(state); if (type == "{" || type == ";") return popAndPass(type, stream, state); if (type == "word") override = "variable"; else if (type != "variable" && type != "(" && type != ")") override = "error"; return "interpolation"; }; return { startState: function(base) { return {tokenize: null, state: parserConfig.inline ? "block" : "top", stateArg: null, context: new Context(parserConfig.inline ? "block" : "top", base || 0, null)}; }, token: function(stream, state) { if (!state.tokenize && stream.eatSpace()) return null; var style = (state.tokenize || tokenBase)(stream, state); if (style && typeof style == "object") { type = style[1]; style = style[0]; } override = style; state.state = states[state.state](type, stream, state); return override; }, indent: function(state, textAfter) { var cx = state.context, ch = textAfter && textAfter.charAt(0); var indent = cx.indent; if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev; if (cx.prev && (ch == "}" && (cx.type == "block" || cx.type == "top" || cx.type == "interpolation" || cx.type == "restricted_atBlock") || ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") || ch == "{" && (cx.type == "at" || cx.type == "atBlock"))) { indent = cx.indent - indentUnit; cx = cx.prev; } return indent; }, electricChars: "}", blockCommentStart: "/*", blockCommentEnd: "*/", fold: "brace" }; }); function keySet(array) { var keys = {}; for (var i = 0; i < array.length; ++i) { keys[array[i]] = true; } return keys; } var documentTypes_ = [ "domain", "regexp", "url", "url-prefix" ], documentTypes = keySet(documentTypes_); var mediaTypes_ = [ "all", "aural", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "embossed" ], mediaTypes = keySet(mediaTypes_); var mediaFeatures_ = [ "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", "orientation", "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio", "pointer", "any-pointer", "hover", "any-hover" ], mediaFeatures = keySet(mediaFeatures_); var mediaValueKeywords_ = [ "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover", "interlace", "progressive" ], mediaValueKeywords = keySet(mediaValueKeywords_); var propertyKeywords_ = [ "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", "object-fit", "object-position", "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-image-threshold", "shape-inside", "shape-margin", "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", // SVG-specific "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" ], propertyKeywords = keySet(propertyKeywords_); var nonStandardPropertyKeywords_ = [ "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" ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_); var fontProperties_ = [ "font-family", "src", "unicode-range", "font-variant", "font-feature-settings", "font-stretch", "font-weight", "font-style" ], fontProperties = keySet(fontProperties_); var counterDescriptors_ = [ "additive-symbols", "fallback", "negative", "pad", "prefix", "range", "speak-as", "suffix", "symbols", "system" ], counterDescriptors = keySet(counterDescriptors_); var colorKeywords_ = [ "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", "rebeccapurple", "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" ], colorKeywords = keySet(colorKeywords_); var valueKeywords_ = [ "above", "absolute", "activeborder", "additive", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate", "always", "amharic", "amharic-abegede", "antialiased", "appworkspace", "arabic-indic", "armenian", "asterisks", "attr", "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", "bullets", "button", "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote", "col-resize", "collapse", "column", "column-reverse", "compact", "condensed", "contain", "content", "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "cyclic", "dashed", "decimal", "decimal-leading-zero", "default", "default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", "disc", "discard", "disclosure-closed", "disclosure-open", "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", "ethiopic-numeric", "ew-resize", "expanded", "extends", "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "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-flex", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "japanese-formal", "japanese-informal", "justify", "kannada", "katakana", "katakana-iroha", "keep-all", "khmer", "korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal", "landscape", "lao", "large", "larger", "left", "level", "lighter", "line-through", "linear", "linear-gradient", "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", "matrix", "matrix3d", "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", "numbers", "numeric", "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", "perspective", "plus-darker", "plus-lighter", "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button", "radial-gradient", "radio", "read-only", "read-write", "read-write-plaintext-only", "rectangle", "region", "relative", "repeat", "repeating-linear-gradient", "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running", "s-resize", "sans-serif", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "scroll", "scrollbar", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button", "searchfield-results-decoration", "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", "simp-chinese-formal", "simp-chinese-informal", "single", "skew", "skewX", "skewY", "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", "space-around", "space-between", "spell-out", "square", "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", "tamil", "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", "trad-chinese-formal", "trad-chinese-informal", "translate", "translate3d", "translateX", "translateY", "translateZ", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal", "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", "var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "wider", "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor", "xx-large", "xx-small" ], valueKeywords = keySet(valueKeywords_); var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_) .concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_) .concat(valueKeywords_); CodeMirror.registerHelper("hintWords", "css", allWords); function tokenCComment(stream, state) { var maybeEnd = false, ch; while ((ch = stream.next()) != null) { if (maybeEnd && ch == "index.html") { state.tokenize = null; break; } maybeEnd = (ch == "*"); } return ["comment", "comment"]; } CodeMirror.defineMIME("text/css", { documentTypes: documentTypes, mediaTypes: mediaTypes, mediaFeatures: mediaFeatures, mediaValueKeywords: mediaValueKeywords, propertyKeywords: propertyKeywords, nonStandardPropertyKeywords: nonStandardPropertyKeywords, fontProperties: fontProperties, counterDescriptors: counterDescriptors, colorKeywords: colorKeywords, valueKeywords: valueKeywords, tokenHooks: { "/": function(stream, state) { if (!stream.eat("*")) return false; state.tokenize = tokenCComment; return tokenCComment(stream, state); } }, name: "css" }); CodeMirror.defineMIME("text/x-scss", { mediaTypes: mediaTypes, mediaFeatures: mediaFeatures, mediaValueKeywords: mediaValueKeywords, propertyKeywords: propertyKeywords, nonStandardPropertyKeywords: nonStandardPropertyKeywords, colorKeywords: colorKeywords, valueKeywords: valueKeywords, fontProperties: fontProperties, allowNested: true, tokenHooks: { "/": function(stream, state) { if (stream.eat("index.html")) { stream.skipToEnd(); return ["comment", "comment"]; } else if (stream.eat("*")) { state.tokenize = tokenCComment; return tokenCComment(stream, state); } else { return ["operator", "operator"]; } }, ":": function(stream) { if (stream.match(/\s*\{/)) return [null, "{"]; return false; }, "$": function(stream) { stream.match(/^[\w-]+/); if (stream.match(/^\s*:/, false)) return ["variable-2", "variable-definition"]; return ["variable-2", "variable"]; }, "#": function(stream) { if (!stream.eat("{")) return false; return [null, "interpolation"]; } }, name: "css", helperType: "scss" }); CodeMirror.defineMIME("text/x-less", { mediaTypes: mediaTypes, mediaFeatures: mediaFeatures, mediaValueKeywords: mediaValueKeywords, propertyKeywords: propertyKeywords, nonStandardPropertyKeywords: nonStandardPropertyKeywords, colorKeywords: colorKeywords, valueKeywords: valueKeywords, fontProperties: fontProperties, allowNested: true, tokenHooks: { "/": function(stream, state) { if (stream.eat("index.html")) { stream.skipToEnd(); return ["comment", "comment"]; } else if (stream.eat("*")) { state.tokenize = tokenCComment; return tokenCComment(stream, state); } else { return ["operator", "operator"]; } }, "@": function(stream) { if (stream.eat("{")) return [null, "interpolation"]; if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false; stream.eatWhile(/[\w\\\-]/); if (stream.match(/^\s*:/, false)) return ["variable-2", "variable-definition"]; return ["variable-2", "variable"]; }, "&": function() { return ["atom", "atom"]; } }, name: "css", helperType: "less" }); }); // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../lib/codemirror")); else if (typeof define == "function" && define.amd) // AMD define(["../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { CodeMirror.defineOption("placeholder", "", function(cm, val, old) { var prev = old && old != CodeMirror.Init; if (val && !prev) { cm.on("blur", onBlur); cm.on("change", onChange); cm.on("swapDoc", onChange); onChange(cm); } else if (!val && prev) { cm.off("blur", onBlur); cm.off("change", onChange); cm.off("swapDoc", onChange); clearPlaceholder(cm); var wrapper = cm.getWrapperElement(); wrapper.className = wrapper.className.replace(" CodeMirror-empty", ""); } if (val && !cm.hasFocus()) onBlur(cm); }); function clearPlaceholder(cm) { if (cm.state.placeholder) { cm.state.placeholder.parentNode.removeChild(cm.state.placeholder); cm.state.placeholder = null; } } function setPlaceholder(cm) { clearPlaceholder(cm); var elt = cm.state.placeholder = document.createElement("pre"); elt.style.cssText = "height: 0; overflow: visible"; elt.style.direction = cm.getOption("direction"); elt.className = "CodeMirror-placeholder"; var placeHolder = cm.getOption("placeholder") if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder) elt.appendChild(placeHolder) cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild); } function onBlur(cm) { if (isEmpty(cm)) setPlaceholder(cm); } function onChange(cm) { var wrapper = cm.getWrapperElement(), empty = isEmpty(cm); wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : ""); if (empty) setPlaceholder(cm); else clearPlaceholder(cm); } function isEmpty(cm) { return (cm.lineCount() === 1) && (cm.getLine(0) === ""); } }); // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../../lib/codemirror")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; function Bar(cls, orientation, scroll) { this.orientation = orientation; this.scroll = scroll; this.screen = this.total = this.size = 1; this.pos = 0; this.node = document.createElement("div"); this.node.className = cls + "-" + orientation; this.inner = this.node.appendChild(document.createElement("div")); var self = this; CodeMirror.on(this.inner, "mousedown", function(e) { if (e.which != 1) return; CodeMirror.e_preventDefault(e); var axis = self.orientation == "horizontal" ? "pageX" : "pageY"; var start = e[axis], startpos = self.pos; function done() { CodeMirror.off(document, "mousemove", move); CodeMirror.off(document, "mouseup", done); } function move(e) { if (e.which != 1) return done(); self.moveTo(startpos + (e[axis] - start) * (self.total / self.size)); } CodeMirror.on(document, "mousemove", move); CodeMirror.on(document, "mouseup", done); }); CodeMirror.on(this.node, "click", function(e) { CodeMirror.e_preventDefault(e); var innerBox = self.inner.getBoundingClientRect(), where; if (self.orientation == "horizontal") where = e.clientX < innerBox.left ? -1 : e.clientX > innerBox.right ? 1 : 0; else where = e.clientY < innerBox.top ? -1 : e.clientY > innerBox.bottom ? 1 : 0; self.moveTo(self.pos + where * self.screen); }); function onWheel(e) { var moved = CodeMirror.wheelEventPixels(e)[self.orientation == "horizontal" ? "x" : "y"]; var oldPos = self.pos; self.moveTo(self.pos + moved); if (self.pos != oldPos) CodeMirror.e_preventDefault(e); } CodeMirror.on(this.node, "mousewheel", onWheel); CodeMirror.on(this.node, "DOMMouseScroll", onWheel); } Bar.prototype.moveTo = function(pos, update) { if (pos < 0) pos = 0; if (pos > this.total - this.screen) pos = this.total - this.screen; if (pos == this.pos) return; this.pos = pos; this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = (pos * (this.size / this.total)) + "px"; if (update !== false) this.scroll(pos, this.orientation); }; var minButtonSize = 10; Bar.prototype.update = function(scrollSize, clientSize, barSize) { this.screen = clientSize; this.total = scrollSize; this.size = barSize; var buttonSize = this.screen * (this.size / this.total); if (buttonSize < minButtonSize) { this.size -= minButtonSize - buttonSize; buttonSize = minButtonSize; } this.inner.style[this.orientation == "horizontal" ? "width" : "height"] = buttonSize + "px"; this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = this.pos * (this.size / this.total) + "px"; }; function SimpleScrollbars(cls, place, scroll) { this.addClass = cls; this.horiz = new Bar(cls, "horizontal", scroll); place(this.horiz.node); this.vert = new Bar(cls, "vertical", scroll); place(this.vert.node); this.width = null; } SimpleScrollbars.prototype.update = function(measure) { if (this.width == null) { var style = window.getComputedStyle ? window.getComputedStyle(this.horiz.node) : this.horiz.node.currentStyle; if (style) this.width = parseInt(style.height); } var width = this.width || 0; var needsH = measure.scrollWidth > measure.clientWidth + 1; var needsV = measure.scrollHeight > measure.clientHeight + 1; this.vert.node.style.display = needsV ? "block" : "none"; this.horiz.node.style.display = needsH ? "block" : "none"; if (needsV) { this.vert.update(measure.scrollHeight, measure.clientHeight, measure.viewHeight - (needsH ? width : 0)); this.vert.node.style.display = "block"; this.vert.node.style.bottom = needsH ? width + "px" : "0"; } if (needsH) { this.horiz.update(measure.scrollWidth, measure.clientWidth, measure.viewWidth - (needsV ? width : 0) - measure.barLeft); this.horiz.node.style.right = needsV ? width + "px" : "0"; this.horiz.node.style.left = measure.barLeft + "px"; } return {right: needsV ? width : 0, bottom: needsH ? width : 0}; }; SimpleScrollbars.prototype.setScrollTop = function(pos) { this.vert.moveTo(pos, false); }; SimpleScrollbars.prototype.setScrollLeft = function(pos) { this.horiz.moveTo(pos, false); }; SimpleScrollbars.prototype.clear = function() { var parent = this.horiz.node.parentNode; parent.removeChild(this.horiz.node); parent.removeChild(this.vert.node); }; CodeMirror.scrollbarModel.simple = function(place, scroll) { return new SimpleScrollbars("CodeMirror-simplescroll", place, scroll); }; CodeMirror.scrollbarModel.overlay = function(place, scroll) { return new SimpleScrollbars("CodeMirror-overlayscroll", place, scroll); }; });