react-templates/playground/dist/home.min.js

10 lines
197 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
/**
* @license RequireJS text 2.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/requirejs/text for details
*/
(function(e){if(typeof exports=="object"&&typeof module=="object")module.exports=e();else{if(typeof define=="function"&&define.amd)return define("libs/codemirror-4.8/lib/codemirror",[],e);this.CodeMirror=e()}})(function(){"use strict";function S(e,t){if(!(this instanceof S))return new S(e,t);this.options=t=t?zo(t):{},zo(fi,t,!1),H(t);var n=t.value;typeof n=="string"&&(n=new js(n,t.mode)),this.doc=n;var s=this.display=new x(e,n);s.wrapper.CodeMirror=this,M(this),A(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),t.autofocus&&!d&&er(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Do,keySeq:null},r&&i<11&&setTimeout(Wo(Zn,this,!0),20),rr(this),fu(),kn(this),this.curOp.forceUpdate=!0,Rs(this,n),t.autofocus&&!d||nu()==s.input?setTimeout(Wo(Pr,this),20):Hr(this);for(var o in li)li.hasOwnProperty(o)&&li[o](this,t[o],hi);R(this);for(var u=0;u<mi.length;++u)mi[u](this);An(this)}function x(e,t){var n=this,o=n.input=Go("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");s?o.style.width="1000px":o.setAttribute("wrap","off"),p&&(o.style.border="1px solid black"),o.setAttribute("autocorrect","off"),o.setAttribute("autocapitalize","off"),o.setAttribute("spellcheck","false"),n.inputDiv=Go("div",[o],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),n.scrollbarH=Go("div",[Go("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),n.scrollbarV=Go("div",[Go("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n.scrollbarFiller=Go("div",null,"CodeMirror-scrollbar-filler"),n.gutterFiller=Go("div",null,"CodeMirror-gutter-filler"),n.lineDiv=Go("div",null,"CodeMirror-code"),n.selectionDiv=Go("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=Go("div",null,"CodeMirror-cursors"),n.measure=Go("div",null,"CodeMirror-measure"),n.lineMeasure=Go("div",null,"CodeMirror-measure"),n.lineSpace=Go("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=Go("div",[Go("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=Go("div",[n.mover],"CodeMirror-sizer"),n.heightForcer=Go("div",null,null,"position: absolute; height: "+Lo+"px; width: 1px;"),n.gutters=Go("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=Go("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=Go("div",[n.inputDiv,n.scrollbarH,n.scrollbarV,n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),r&&i<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),p&&(o.style.width="0px"),s||(n.scroller.draggable=!0),l&&(n.inputDiv.style.height="1px",n.inputDiv.style.position="absolute"),r&&i<8&&(n.scrollbarH.style.minHeight=n.scrollbarV.style.minWidth="18px"),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.view=[],n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.prevInput="",n.alignWidgets=!1,n.pollingFast=!1,n.poll=new Do,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.inaccurateSelection=!1,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null}function T(e){e.doc.mode=S.getMode(e.options,e.doc.modeOption),N(e)}function N(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Xt(e,100),e.state.modeGen++,e.curOp&&Un(e)}function C(e){e.options.lineWrapping?(su(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth=""):(iu(e.display.wrapper,"CodeMirror-wrap"),P(e)),L(e),Un(e),cn(e),setTimeout(function(){F(e)},100)}function k(e){var t=xn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Tn(e.display)-3);return function(i){if(ss(e.doc,i))return 0;var s=0;if(i.widgets)for(var o=0;o<i.widgets.length;o++)i.widgets[o].height&&(s+=i.widgets[o].height);return n?s+(Math.ceil(i.text.length/r)||1)*t:s+t}}function L(e){var t=e.doc,n=k(e);t.iter(function(e){var t=n(e);t!=e.height&&Xs(e,t)})}function A(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),cn(e)}function O(e){M(e),Un(e),setTimeout(function(){q(e)},20)}function M(e){var t=e.display.gutters,n=e.options.gutters;Zo(t);for(var r=0;r<n.length;++r){var i=n[r],s=t.appendChild(Go("div",null,"CodeMirror-gutter "+i));i=="CodeMirror-linenumbers"&&(e.display.lineGutter=s,s.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=r?"":"none",_(e)}function _(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 D(e){if(e.height==0)return 0;var t=e.text.length,n,r=e;while(n=Yi(r)){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}r=e;while(n=Zi(r)){var i=n.find(0,!0);t-=r.text.length-i.from.ch,r=i.to.line,t+=r.text.length-i.to.ch}return t}function P(e){var t=e.display,n=e.doc;t.maxLine=Us(n,n.first),t.maxLineLength=D(t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var n=D(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function H(e){var t=qo(e.gutters,"CodeMirror-linenumbers");t==-1&&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 B(e){return e.display.scroller.clientHeight-e.display.wrapper.clientHeight<Lo-3}function j(e){var t=e.display.scroller;return{clientHeight:t.clientHeight,barHeight:e.display.scrollbarV.clientHeight,scrollWidth:t.scrollWidth,clientWidth:t.clientWidth,hScrollbarTakesSpace:B(e),barWidth:e.display.scrollbarH.clientWidth,docHeight:Math.round(e.doc.height+Qt(e.display))}}function F(e,t){t||(t=j(e));var n=e.display,r=pu(n.measure),i=t.docHeight+Lo,s=t.scrollWidth>t.clientWidth;s&&t.scrollWidth<=t.clientWidth+1&&r>0&&!t.hScrollbarTakesSpace&&(s=!1);var o=i>t.clientHeight;o?(n.scrollbarV.style.display="block",n.scrollbarV.style.bottom=s?r+"px":"0",n.scrollbarV.firstChild.style.height=Math.max(0,i-t.clientHeight+(t.barHeight||n.scrollbarV.clientHeight))+"px"):(n.scrollbarV.style.display="",n.scrollbarV.firstChild.style.height="0"),s?(n.scrollbarH.style.display="block",n.scrollbarH.style.right=o?r+"px":"0",n.scrollbarH.firstChild.style.width=t.scrollWidth-t.clientWidth+(t.barWidth||n.scrollbarH.clientWidth)+"px"):(n.scrollbarH.style.display="",n.scrollbarH.firstChild.style.width="0"),s&&o?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=n.scrollbarFiller.style.width=r+"px"):n.scrollbarFiller.style.display="",s&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r+"px",n.gutterFiller.style.width=n.gutters.offsetWidth+"px"):n.gutterFiller.style.display="";if(!e.state.checkedOverlayScrollbar&&t.clientHeight>0){if(r===0){var u=v&&!c?"12px":"18px";n.scrollbarV.style.minWidth=n.scrollbarH.style.minHeight=u;var a=function(t){mo(t)!=n.scrollbarV&&mo(t)!=n.scrollbarH&&jn(e,ur)(t)};yo(n.scrollbarV,"mousedown",a),yo(n.scrollbarH,"mousedown",a)}e.state.checkedOverlayScrollbar=!0}}function I(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Kt(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,s=$s(t,r),o=$s(t,i);if(n&&n.ensure){var u=n.ensure.from.line,a=n.ensure.to.line;if(u<s)return{from:u,to:$s(t,Js(Us(t,u))+e.wrapper.clientHeight)};if(Math.min(a,t.lastLine())>=o)return{from:$s(t,Js(Us(t,a))-e.wrapper.clientHeight),to:a}}return{from:s,to:Math.max(o,s+1)}}function q(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;var r=z(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,s=r+"px";for(var o=0;o<n.length;o++)if(!n[o].hidden){e.options.fixedGutter&&n[o].gutter&&(n[o].gutter.style.left=s);var u=n[o].alignable;if(u)for(var a=0;a<u.length;a++)u[a].style.left=s}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function R(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=U(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(Go("div",[Go("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),s=i.firstChild.offsetWidth,o=i.offsetWidth-s;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(s,r.lineGutter.offsetWidth-o),r.lineNumWidth=r.lineNumInnerWidth+o,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",_(e),!0}return!1}function U(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function z(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function W(e,t,n){var r=e.display;this.viewport=t,this.visible=I(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldViewFrom=r.viewFrom,this.oldViewTo=r.viewTo,this.oldScrollerWidth=r.scroller.clientWidth,this.force=n,this.dims=Y(e)}function X(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Wn(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&Jn(e)==0)return!1;R(e)&&(Wn(e),t.dims=Y(e));var i=r.first+r.size,s=Math.max(t.visible.from-e.options.viewportMargin,r.first),o=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<s&&s-n.viewFrom<20&&(s=Math.max(r.first,n.viewFrom)),n.viewTo>o&&n.viewTo-o<20&&(o=Math.min(i,n.viewTo)),E&&(s=rs(e.doc,s),o=is(e.doc,o));var u=s!=n.viewFrom||o!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;$n(e,s,o),n.viewOffset=Js(Us(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var a=Jn(e);if(!u&&a==0&&!t.force&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var f=nu();return a>4&&(n.lineDiv.style.display="none"),Z(e,n.updateLineNumbers,t.dims),a>4&&(n.lineDiv.style.display=""),f&&nu()!=f&&f.offsetHeight&&f.focus(),Zo(n.cursorDiv),Zo(n.selectionDiv),u&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Xt(e,400)),n.updateLineNumbers=null,!0}function V(e,t){var n=t.force,r=t.viewport;for(var i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldScrollerWidth!=e.display.scroller.clientWidth)n=!0;else{n=!1,r&&r.top!=null&&(r={top:Math.min(e.doc.height+Qt(e.display)-Lo-e.display.scroller.clientHeight,r.top)}),t.visible=I(e.display,e.doc,r);if(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}if(!X(e,t))break;Q(e);var s=j(e);Rt(e),J(e,s),F(e,s)}So(e,"update",e),(e.display.viewFrom!=t.oldViewFrom||e.display.viewTo!=t.oldViewTo)&&So(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo)}function $(e,t){var n=new W(e,t);if(X(e,n)){Q(e),V(e,n);var r=j(e);Rt(e),J(e,r),F(e,r)}}function J(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-Lo)+"px"}function K(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 Q(e){var t=e.display,n=t.lineDiv.offsetTop;for(var s=0;s<t.view.length;s++){var o=t.view[s],u;if(o.hidden)continue;if(r&&i<8){var a=o.node.offsetTop+o.node.offsetHeight;u=a-n,n=a}else{var f=o.node.getBoundingClientRect();u=f.bottom-f.top}var l=o.line.height-u;u<2&&(u=xn(t));if(l>.001||l<-0.001){Xs(o.line,u),G(o.line);if(o.rest)for(var c=0;c<o.rest.length;c++)G(o.rest[c])}}}function G(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function Y(e){var t=e.display,n={},r={},i=t.gutters.clientLeft;for(var s=t.gutters.firstChild,o=0;s;s=s.nextSibling,++o)n[e.options.gutters[o]]=s.offsetLeft+s.clientLeft+i,r[e.options.gutters[o]]=s.clientWidth;return{fixedPos:z(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Z(e,t,n){function a(t){var n=t.nextSibling;return s&&v&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,u=o.firstChild,f=r.view,l=r.viewFrom;for(var c=0;c<f.length;c++){var h=f[c];if(!h.hidden)if(!h.node){var p=at(e,h,l,n);o.insertBefore(p,u)}else{while(u!=h.node)u=a(u);var d=i&&t!=null&&t<=l&&h.lineNumber;h.changes&&(qo(h.changes,"gutter")>-1&&(d=!1),et(e,h,l,n)),d&&(Zo(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(U(e.options,l)))),u=h.node.nextSibling}l+=h.size}while(u)u=a(u)}function et(e,t,n,r){for(var i=0;i<t.changes.length;i++){var s=t.changes[i];s=="text"?it(e,t):s=="gutter"?ot(e,t,n,r):s=="class"?st(t):s=="widget"&&ut(t,r)}t.changes=null}function tt(e){return e.node==e.text&&(e.node=Go("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),r&&i<8&&(e.node.style.zIndex=2)),e.node}function nt(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;t&&(t+=" CodeMirror-linebackground");if(e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var n=tt(e);e.background=n.insertBefore(Go("div",null,t),n.firstChild)}}function rt(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ns(e,t)}function it(e,t){var n=t.text.className,r=rt(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,st(t)):n&&(t.text.className=n)}function st(e){nt(e),e.line.wrapClass?tt(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 ot(e,t,n,r){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var s=tt(t),o=t.gutter=s.insertBefore(Go("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),t.text);t.line.gutterClass&&(o.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!i||!i["CodeMirror-linenumbers"])&&(t.lineNumber=o.appendChild(Go("div",U(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px")));if(i)for(var u=0;u<e.options.gutters.length;++u){var a=e.options.gutters[u],f=i.hasOwnProperty(a)&&i[a];f&&o.appendChild(Go("div",[f],"CodeMirror-gutter-elt","left: "+r.gutterLeft[a]+"px; width: "+r.gutterWidth[a]+"px"))}}}function ut(e,t){e.alignable&&(e.alignable=null);for(var n=e.node.firstChild,r;n;n=r){var r=n.nextSibling;n.className=="CodeMirror-linewidget"&&e.node.removeChild(n)}ft(e,t)}function at(e,t,n,r){var i=rt(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),st(t),ot(e,t,n,r),ft(t,r),t.node}function ft(e,t){lt(e.line,e,t,!0);if(e.rest)for(var n=0;n<e.rest.length;n++)lt(e.rest[n],e,t,!1)}function lt(e,t,n,r){if(!e.widgets)return;var i=tt(t);for(var s=0,o=e.widgets;s<o.length;++s){var u=o[s],a=Go("div",[u.node],"CodeMirror-linewidget");u.handleMouseEvents||(a.ignoreEvents=!0),ct(u,a,t,n),r&&u.above?i.insertBefore(a,t.gutter||t.text):i.appendChild(a),So(u,"redraw")}}function ct(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function dt(e){return ht(e.line,e.ch)}function vt(e,t){return pt(e,t)<0?t:e}function mt(e,t){return pt(e,t)<0?e:t}function gt(e,t){this.ranges=e,this.primIndex=t}function yt(e,t){this.anchor=e,this.head=t}function bt(e,t){var n=e[t];e.sort(function(e,t){return pt(e.from(),t.from())}),t=qo(e,n);for(var r=1;r<e.length;r++){var i=e[r],s=e[r-1];if(pt(s.to(),i.from())>=0){var o=mt(s.from(),i.from()),u=vt(s.to(),i.to()),a=s.empty()?i.from()==i.head:s.from()==s.head;r<=t&&--t,e.splice(--r,2,new yt(a?u:o,a?o:u))}}return new gt(e,t)}function wt(e,t){return new gt([new yt(e,t||e)],0)}function Et(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function St(e,t){if(t.line<e.first)return ht(e.first,0);var n=e.first+e.size-1;return t.line>n?ht(n,Us(e,n).text.length):xt(t,Us(e,t.line).text.length)}function xt(e,t){var n=e.ch;return n==null||n>t?ht(e.line,t):n<0?ht(e.line,0):e}function Tt(e,t){return t>=e.first&&t<e.first+e.size}function Nt(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=St(e,t[r]);return n}function Ct(e,t,n,r){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(r){var s=pt(n,i)<0;s!=pt(r,i)<0?(i=n,n=r):s!=pt(n,r)<0&&(n=r)}return new yt(i,n)}return new yt(r||n,n)}function kt(e,t,n,r){Dt(e,new gt([Ct(e,e.sel.primary(),t,n)],0),r)}function Lt(e,t,n){for(var r=[],i=0;i<e.sel.ranges.length;i++)r[i]=Ct(e,e.sel.ranges[i],t[i],null);var s=bt(r,e.sel.primIndex);Dt(e,s,n)}function At(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Dt(e,bt(i,e.sel.primIndex),r)}function Ot(e,t,n,r){Dt(e,wt(t,n),r)}function Mt(e,t){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new yt(St(e,t[n].anchor),St(e,t[n].head))}};return wo(e,"beforeSelectionChange",e,n),e.cm&&wo(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?bt(n.ranges,n.ranges.length-1):t}function _t(e,t,n){var r=e.history.done,i=Fo(r);i&&i.ranges?(r[r.length-1]=t,Pt(e,t,n)):Dt(e,t,n)}function Dt(e,t,n){Pt(e,t,n),no(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Pt(e,t,n){if(Co(e,"beforeSelectionChange")||e.cm&&Co(e.cm,"beforeSelectionChange"))t=Mt(e,t);var r=n&&n.bias||(pt(t.primary().head,e.sel.primary().head)<0?-1:1);Ht(e,jt(e,t,r,!0)),(!n||n.scroll!==!1)&&e.cm&&ni(e.cm)}function Ht(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,No(e.cm)),So(e,"cursorActivity",e)}function Bt(e){Ht(e,jt(e,e.sel,null,!1),Oo)}function jt(e,t,n,r){var i;for(var s=0;s<t.ranges.length;s++){var o=t.ranges[s],u=Ft(e,o.anchor,n,r),a=Ft(e,o.head,n,r);if(i||u!=o.anchor||a!=o.head)i||(i=t.ranges.slice(0,s)),i[s]=new yt(u,a)}return i?bt(i,t.primIndex):t}function Ft(e,t,n,r){var i=!1,s=t,o=n||1;e.cantEdit=!1;e:for(;;){var u=Us(e,s.line);if(u.markedSpans)for(var a=0;a<u.markedSpans.length;++a){var f=u.markedSpans[a],l=f.marker;if((f.from==null||(l.inclusiveLeft?f.from<=s.ch:f.from<s.ch))&&(f.to==null||(l.inclusiveRight?f.to>=s.ch:f.to>s.ch))){if(r){wo(l,"beforeCursorEnter");if(l.explicitlyCleared){if(!u.markedSpans)break;--a;continue}}if(!l.atomic)continue;var c=l.find(o<0?-1:1);if(pt(c,s)==0){c.ch+=o,c.ch<0?c.line>e.first?c=St(e,ht(c.line-1)):c=null:c.ch>u.text.length&&(c.line<e.first+e.size-1?c=ht(c.line+1,0):c=null);if(!c){if(i)return r?(e.cantEdit=!0,ht(e.first,0)):Ft(e,t,n,!0);i=!0,c=t,o=-o}}s=c;continue e}}return s}}function It(e){var t=e.display,n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),s=r.selection=document.createDocumentFragment();for(var o=0;o<n.sel.ranges.length;o++){var u=n.sel.ranges[o],a=u.empty();(a||e.options.showCursorWhenSelecting)&&Ut(e,u,i),a||zt(e,u,s)}if(e.options.moveInputWithCursor){var f=gn(e,n.sel.primary().head,"div"),l=t.wrapper.getBoundingClientRect(),c=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,f.top+c.top-l.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,f.left+c.left-l.left))}return r}function qt(e,t){eu(e.display.cursorDiv,t.cursors),eu(e.display.selectionDiv,t.selection),t.teTop!=null&&(e.display.inputDiv.style.top=t.teTop+"px",e.display.inputDiv.style.left=t.teLeft+"px")}function Rt(e){qt(e,It(e))}function Ut(e,t,n){var r=gn(e,t.head,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(Go("div"," ","CodeMirror-cursor"));i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px";if(r.other){var s=n.appendChild(Go("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="",s.style.left=r.other.left+"px",s.style.top=r.other.top+"px",s.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function zt(e,t,n){function f(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),s.appendChild(Go("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(n==null?a-e:n)+"px; height: "+(r-t)+"px"))}function l(t,n,r){function h(n,r){return mn(e,ht(t,n),"div",s,r)}var s=Us(i,t),o=s.text.length,l,c;return Tu(Ks(s),n||0,r==null?o:r,function(e,t,i){var s=h(e,"left"),p,d,v;if(e==t)p=s,d=v=s.left;else{p=h(t-1,"right");if(i=="rtl"){var m=s;s=p,p=m}d=s.left,v=p.right}n==null&&e==0&&(d=u),p.top-s.top>3&&(f(d,s.top,null,s.bottom),d=u,s.bottom<p.top&&f(d,s.bottom,null,p.top)),r==null&&t==o&&(v=a);if(!l||s.top<l.top||s.top==l.top&&s.left<l.left)l=s;if(!c||p.bottom>c.bottom||p.bottom==c.bottom&&p.right>c.right)c=p;d<u+1&&(d=u),f(d,p.top,v-d,p.bottom)}),{start:l,end:c}}var r=e.display,i=e.doc,s=document.createDocumentFragment(),o=Gt(e.display),u=o.left,a=r.lineSpace.offsetWidth-o.right,c=t.from(),h=t.to();if(c.line==h.line)l(c.line,c.ch,h.ch);else{var p=Us(i,c.line),d=Us(i,h.line),v=ts(p)==ts(d),m=l(c.line,c.ch,v?p.text.length+1:null).end,g=l(h.line,v?0:null,h.ch).start;v&&(m.top<g.top-2?(f(m.right,m.top,null,m.bottom),f(u,g.top,g.left,g.bottom)):f(m.right,m.top,g.left-m.right,m.bottom)),m.bottom<g.top&&f(u,m.bottom,null,g.top)}n.appendChild(s)}function Wt(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Xt(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Wo(Vt,e))}function Vt(e){var t=e.doc;t.frontier<t.first&&(t.frontier=t.first);if(t.frontier>=e.display.viewTo)return;var n=+(new Date)+e.options.workTime,r=yi(t.mode,Jt(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(s){if(t.frontier>=e.display.viewFrom){var o=s.styles,u=bs(e,s,r,!0);s.styles=u.styles;var a=s.styleClasses,f=u.classes;f?s.styleClasses=f:a&&(s.styleClasses=null);var l=!o||o.length!=s.styles.length||a!=f&&(!a||!f||a.bgClass!=f.bgClass||a.textClass!=f.textClass);for(var c=0;!l&&c<o.length;++c)l=o[c]!=s.styles[c];l&&i.push(t.frontier),s.stateAfter=yi(t.mode,r)}else Es(e,s.text,r),s.stateAfter=t.frontier%5==0?yi(t.mode,r):null;++t.frontier;if(+(new Date)>n)return Xt(e,e.options.workDelay),!0}),i.length&&Bn(e,function(){for(var t=0;t<i.length;t++)zn(e,i[t],"text")})}function $t(e,t,n){var r,i,s=e.doc,o=n?-1:t-(e.doc.mode.innerMode?1e3:100);for(var u=t;u>o;--u){if(u<=s.first)return s.first;var a=Us(s,u-1);if(a.stateAfter&&(!n||u<=s.frontier))return u;var f=Po(a.text,null,e.options.tabSize);if(i==null||r>f)i=u-1,r=f}return i}function Jt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var s=$t(e,t,n),o=s>r.first&&Us(r,s-1).stateAfter;return o?o=yi(r.mode,o):o=bi(r.mode),r.iter(s,t,function(n){Es(e,n.text,o);var u=s==t-1||s%5==0||s>=i.viewFrom&&s<i.viewTo;n.stateAfter=u?yi(r.mode,o):null,++s}),n&&(r.frontier=s),o}function Kt(e){return e.lineSpace.offsetTop}function Qt(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Gt(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=eu(e.measure,Go("pre","x")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Yt(e,t,n){var r=e.options.lineWrapping,i=r&&e.display.scroller.clientWidth;if(!t.measure.heights||r&&t.measure.width!=i){var s=t.measure.heights=[];if(r){t.measure.width=i;var o=t.text.firstChild.getClientRects();for(var u=0;u<o.length-1;u++){var a=o[u],f=o[u+1];Math.abs(a.bottom-f.bottom)>2&&s.push((a.bottom+f.top)/2-n.top)}}s.push(n.bottom-n.top)}}function Zt(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var r=0;r<e.rest.length;r++)if(Vs(e.rest[r])>n)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function en(e,t){t=ts(t);var n=Vs(t),r=e.display.externalMeasured=new qn(e.doc,t,n);r.lineN=n;var i=r.built=Ns(e,r);return r.text=i.pre,eu(e.display.lineMeasure,i.pre),r}function tn(e,t,n,r){return sn(e,rn(e,t),n,r)}function nn(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Xn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function rn(e,t){var n=Vs(t),r=nn(e,n);r&&!r.text?r=null:r&&r.changes&&et(e,r,n,Y(e)),r||(r=en(e,t));var i=Zt(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function sn(e,t,n,r,i){t.before&&(n=-1);var s=n+(r||""),o;return t.cache.hasOwnProperty(s)?o=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Yt(e,t.view,t.rect),t.hasHeights=!0),o=un(e,t,n,r),o.bogus||(t.cache[s]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function un(e,t,n,s){var o=t.map,u,a,f,l;for(var c=0;c<o.length;c+=3){var h=o[c],p=o[c+1];if(n<h)a=0,f=1,l="left";else if(n<p)a=n-h,f=a+1;else if(c==o.length-3||n==p&&o[c+3]>n)f=p-h,a=f-1,n>=p&&(l="right");if(a!=null){u=o[c+2],h==p&&s==(u.insertLeft?"left":"right")&&(l=s);if(s=="left"&&a==0)while(c&&o[c-2]==o[c-3]&&o[c-1].insertLeft)u=o[(c-=3)+2],l="left";if(s=="right"&&a==p-h)while(c<o.length-3&&o[c+3]==o[c+4]&&!o[c+5].insertLeft)u=o[(c+=3)+2],l="right";break}}var d;if(u.nodeType==3){for(var c=0;c<4;c++){while(a&&Qo(t.line.text.charAt(h+a)))--a;while(h+f<p&&Qo(t.line.text.charAt(h+f)))++f;if(r&&i<9&&a==0&&f==p-h)d=u.parentNode.getBoundingClientRect();else if(r&&e.options.lineWrapping){var v=Yo(u,a,f).getClientRects();v.length?d=v[s=="right"?v.length-1:0]:d=on}else d=Yo(u,a,f).getBoundingClientRect()||on;if(d.left||d.right||a==0)break;f=a,a-=1,l="right"}r&&i<11&&(d=an(e.display.measure,d))}else{a>0&&(l=s="right");var v;e.options.lineWrapping&&(v=u.getClientRects()).length>1?d=v[s=="right"?v.length-1:0]:d=u.getBoundingClientRect()}if(r&&i<9&&!a&&(!d||!d.left&&!d.right)){var m=u.parentNode.getClientRects()[0];m?d={left:m.left,right:m.left+Tn(e.display),top:m.top,bottom:m.bottom}:d=on}var g=d.top-t.rect.top,y=d.bottom-t.rect.top,b=(g+y)/2,w=t.view.measure.heights;for(var c=0;c<w.length-1;c++)if(b<w[c])break;var E=c?w[c-1]:0,S=w[c],x={left:(l=="right"?d.right:d.left)-t.rect.left,right:(l=="left"?d.left:d.right)-t.rect.left,top:E,bottom:S};return!d.left&&!d.right&&(x.bogus=!0),e.options.singleCursorHeightPerLine||(x.rtop=g,x.rbottom=y),x}function an(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Su(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function fn(e){if(e.measure){e.measure.cache={},e.measure.heights=null;if(e.rest)for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}}function ln(e){e.display.externalMeasure=null,Zo(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)fn(e.display.view[t])}function cn(e){ln(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function hn(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function pn(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function dn(e,t,n,r){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var s=fs(t.widgets[i]);n.top+=s,n.bottom+=s}if(r=="line")return n;r||(r="local");var o=Js(t);r=="local"?o+=Kt(e.display):o-=e.display.viewOffset;if(r=="page"||r=="window"){var u=e.display.lineSpace.getBoundingClientRect();o+=u.top+(r=="window"?0:pn());var a=u.left+(r=="window"?0:hn());n.left+=a,n.right+=a}return n.top+=o,n.bottom+=o,n}function vn(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=hn(),i-=pn();else if(n=="local"||!n){var s=e.display.sizer.getBoundingClientRect();r+=s.left,i+=s.top}var o=e.display.lineSpace.getBoundingClientRect();return{left:r-o.left,top:i-o.top}}function mn(e,t,n,r,i){return r||(r=Us(e.doc,t.line)),dn(e,r,tn(e,r,t.ch,i),n)}function gn(e,t,n,r,i,s){function o(t,o){var u=sn(e,i,t,o?"right":"left",s);return o?u.left=u.right:u.right=u.left,dn(e,r,u,n)}function u(e,t){var n=a[t],r=n.level%2;return e==Nu(n)&&t&&n.level<a[t-1].level?(n=a[--t],e=Cu(n)-(n.level%2?0:1),r=!0):e==Cu(n)&&t<a.length-1&&n.level<a[t+1].level&&(n=a[++t],e=Nu(n)-n.level%2,r=!1),r&&e==n.to&&e>n.from?o(e-1):o(e,r)}r=r||Us(e.doc,t.line),i||(i=rn(e,r));var a=Ks(r),f=t.ch;if(!a)return o(f);var l=Pu(a,f),c=u(f,l);return Du!=null&&(c.other=u(f,Du)),c}function yn(e,t){var n=0,t=St(e.doc,t);e.options.lineWrapping||(n=Tn(e.display)*t.ch);var r=Us(e.doc,t.line),i=Js(r)+Kt(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function bn(e,t,n,r){var i=ht(e,t);return i.xRel=r,n&&(i.outside=!0),i}function wn(e,t,n){var r=e.doc;n+=e.display.viewOffset;if(n<0)return bn(r.first,0,!0,-1);var i=$s(r,n),s=r.first+r.size-1;if(i>s)return bn(r.first+r.size-1,Us(r,s).text.length,!0,1);t<0&&(t=0);var o=Us(r,i);for(;;){var u=En(e,o,i,t,n),a=Zi(o),f=a&&a.find(0,!0);if(!a||!(u.ch>f.from.ch||u.ch==f.from.ch&&u.xRel>0))return u;i=Vs(o=f.to.line)}}function En(e,t,n,r,i){function f(r){var i=gn(e,ht(n,r),"line",t,a);return o=!0,s>i.bottom?i.left-u:s<i.top?i.left+u:(o=!1,i.left)}var s=i-Js(t),o=!1,u=2*e.display.wrapper.clientWidth,a=rn(e,t),l=Ks(t),c=t.text.length,h=ku(t),p=Lu(t),d=f(h),v=o,m=f(p),g=o;if(r>m)return bn(n,p,g,1);for(;;){if(l?p==h||p==Bu(t,h,1):p-h<=1){var y=r<d||r-d<=m-r?h:p,b=r-(y==h?d:m);while(Qo(t.text.charAt(y)))++y;var w=bn(n,y,y==h?v:g,b<-1?-1:b>1?1:0);return w}var E=Math.ceil(c/2),S=h+E;if(l){S=h;for(var x=0;x<E;++x)S=Bu(t,S,1)}var T=f(S);if(T>r){p=S,m=T;if(g=o)m+=1e3;c=E}else h=S,d=T,v=o,c-=E}}function xn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Sn==null){Sn=Go("pre");for(var t=0;t<49;++t)Sn.appendChild(document.createTextNode("x")),Sn.appendChild(Go("br"));Sn.appendChild(document.createTextNode("x"))}eu(e.measure,Sn);var n=Sn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),Zo(e.measure),n||1}function Tn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=Go("span","xxxxxxxxxx"),n=Go("pre",[t]);eu(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function kn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++Cn},Nn?Nn.ops.push(e.curOp):e.curOp.ownsGroup=Nn={ops:[e.curOp],delayedCallbacks:[]}}function Ln(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n]();for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)while(i.cursorActivityCalled<i.cursorActivityHandlers.length)i.cursorActivityHandlers[i.cursorActivityCalled++](i.cm)}}while(n<t.length)}function An(e){var t=e.curOp,n=t.ownsGroup;if(!n)return;try{Ln(n)}finally{Nn=null;for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;On(n)}}function On(e){var t=e.ops;for(var n=0;n<t.length;n++)Mn(t[n]);for(var n=0;n<t.length;n++)_n(t[n]);for(var n=0;n<t.length;n++)Dn(t[n]);for(var n=0;n<t.length;n++)Pn(t[n]);for(var n=0;n<t.length;n++)Hn(t[n])}function Mn(e){var t=e.cm,n=t.display;e.updateMaxLine&&P(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new W(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function _n(e){e.updatedDisplay=e.mustUpdate&&X(e.cm,e.update)}function Dn(e){var t=e.cm,n=t.display;e.updatedDisplay&&Q(t),e.barMeasure=j(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=tn(t,n.maxLine,n.maxLine.text.length).left+3,e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo+Lo-n.scroller.clientWidth));if(e.updatedDisplay||e.selectionChanged)e.newSelectionNodes=It(t)}function Pn(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&br(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.newSelectionNodes&&qt(t,e.newSelectionNodes),e.updatedDisplay&&J(t,e.barMeasure),(e.updatedDisplay||e.startHeight!=t.doc.height)&&F(t,e.barMeasure),e.selectionChanged&&Wt(t),t.state.focused&&e.updateInput&&Zn(t,e.typing)}function Hn(e){var t=e.cm,n=t.display,r=t.doc;e.adjustWidthTo!=null&&Math.abs(e.barMeasure.scrollWidth-t.display.scroller.scrollWidth)>1&&F(t),e.updatedDisplay&&V(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null);if(e.scrollTop!=null&&(n.scroller.scrollTop!=e.scrollTop||e.forceScroll)){var i=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,e.scrollTop));n.scroller.scrollTop=n.scrollbarV.scrollTop=r.scrollTop=i}if(e.scrollLeft!=null&&(n.scroller.scrollLeft!=e.scrollLeft||e.forceScroll)){var o=Math.max(0,Math.min(n.scroller.scrollWidth-n.scroller.clientWidth,e.scrollLeft));n.scroller.scrollLeft=n.scrollbarH.scrollLeft=r.scrollLeft=o,q(t)}if(e.scrollToPos){var u=Yr(t,St(r,e.scrollToPos.from),St(r,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&Gr(t,u)}var a=e.maybeHiddenMarkers,f=e.maybeUnhiddenMarkers;if(a)for(var l=0;l<a.length;++l)a[l].lines.length||wo(a[l],"hide");if(f)for(var l=0;l<f.length;++l)f[l].lines.length&&wo(f[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.updatedDisplay&&s&&(t.options.lineWrapping&&K(t,e.barMeasure),e.barMeasure.scrollWidth>e.barMeasure.clientWidth&&e.barMeasure.scrollWidth<e.barMeasure.clientWidth+1&&!B(t)&&F(t)),e.changeObjs&&wo(t,"changes",t,e.changeObjs)}function Bn(e,t){if(e.curOp)return t();kn(e);try{return t()}finally{An(e)}}function jn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);kn(e);try{return t.apply(e,arguments)}finally{An(e)}}}function Fn(e){return function(){if(this.curOp)return e.apply(this,arguments);kn(this);try{return e.apply(this,arguments)}finally{An(this)}}}function In(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);kn(t);try{return e.apply(this,arguments)}finally{An(t)}}}function qn(e,t,n){this.line=t,this.rest=ns(t),this.size=this.rest?Vs(Fo(this.rest))-n+1:1,this.node=this.text=null,this.hidden=ss(e,t)}function Rn(e,t,n){var r=[],i;for(var s=t;s<n;s=i){var o=new qn(e.doc,Us(e.doc,s),s);i=s+o.size,r.push(o)}return r}function Un(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0;if(t>=i.viewTo)E&&rs(e.doc,t)<i.viewTo&&Wn(e);else if(n<=i.viewFrom)E&&is(e.doc,n+r)>i.viewFrom?Wn(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Wn(e);else if(t<=i.viewFrom){var s=Vn(e,n,n+r,1);s?(i.view=i.view.slice(s.index),i.viewFrom=s.lineN,i.viewTo+=r):Wn(e)}else if(n>=i.viewTo){var s=Vn(e,t,t,-1);s?(i.view=i.view.slice(0,s.index),i.viewTo=s.lineN):Wn(e)}else{var o=Vn(e,t,t,-1),u=Vn(e,n,n+r,1);o&&u?(i.view=i.view.slice(0,o.index).concat(Rn(e,o.lineN,u.lineN)).concat(i.view.slice(u.index)),i.viewTo+=r):Wn(e)}var a=i.externalMeasured;a&&(n<a.lineN?a.lineN+=r:t<a.lineN+a.size&&(i.externalMeasured=null))}function zn(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null);if(t<r.viewFrom||t>=r.viewTo)return;var s=r.view[Xn(e,t)];if(s.node==null)return;var o=s.changes||(s.changes=[]);qo(o,n)==-1&&o.push(n)}function Wn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Xn(e,t){if(t>=e.display.viewTo)return null;t-=e.display.viewFrom;if(t<0)return null;var n=e.display.view;for(var r=0;r<n.length;r++){t-=n[r].size;if(t<0)return r}}function Vn(e,t,n,r){var i=Xn(e,t),s,o=e.display.view;if(!E||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var u=0,a=e.display.viewFrom;u<i;u++)a+=o[u].size;if(a!=t){if(r>0){if(i==o.length-1)return null;s=a+o[i].size-t,i++}else s=a-t;t+=s,n+=s}while(rs(e.doc,n)!=n){if(i==(r<0?0:o.length-1))return null;n+=r*o[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function $n(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Rn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Rn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Xn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Rn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Xn(e,n)))),r.viewTo=n}function Jn(e){var t=e.display.view,n=0;for(var r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function Kn(e){if(e.display.pollingFast)return;e.display.poll.set(e.options.pollInterval,function(){Yn(e),e.state.focused&&Kn(e)})}function Qn(e){function n(){var r=Yn(e);!r&&!t?(t=!0,e.display.poll.set(60,n)):(e.display.pollingFast=!1,Kn(e))}var t=!1;e.display.pollingFast=!0,e.display.poll.set(20,n)}function Yn(e){var t=e.display.input,n=e.display.prevInput,s=e.doc;if(!e.state.focused||bu(t)&&!n||nr(e)||e.options.disableInput||e.state.keySeq)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var o=t.value;if(o==n&&!e.somethingSelected())return!1;if(r&&i>=9&&e.display.inputHasSelection===o||v&&/[\uf700-\uf7ff]/.test(o))return Zn(e),!1;var u=!e.curOp;u&&kn(e),e.display.shift=!1,o.charCodeAt(0)==8203&&s.sel==e.display.selForContextMenu&&!n&&(n="");var a=0,f=Math.min(n.length,o.length);while(a<f&&n.charCodeAt(a)==o.charCodeAt(a))++a;var l=o.slice(a),c=yu(l),h=null;e.state.pasteIncoming&&s.sel.ranges.length>1&&(Gn&&Gn.join("\n")==l?h=s.sel.ranges.length%Gn.length==0&&Ro(Gn,yu):c.length==s.sel.ranges.length&&(h=Ro(c,function(e){return[e]})));for(var p=s.sel.ranges.length-1;p>=0;p--){var d=s.sel.ranges[p],m=d.from(),g=d.to();a<n.length?m=ht(m.line,m.ch-(n.length-a)):e.state.overwrite&&d.empty()&&!e.state.pasteIncoming&&(g=ht(g.line,Math.min(Us(s,g.line).text.length,g.ch+Fo(c).length)));var y=e.curOp.updateInput,b={from:m,to:g,text:h?h[p%h.length]:c,origin:e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input"};Wr(e.doc,b),So(e,"inputRead",e,b);if(l&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&d.head.ch<100&&(!p||s.sel.ranges[p-1].head.line!=d.head.line)){var w=e.getModeAt(d.head),E=Fr(b);if(w.electricChars){for(var S=0;S<w.electricChars.length;S++)if(l.indexOf(w.electricChars.charAt(S))>-1){ii(e,E.line,"smart");break}}else w.electricInput&&w.electricInput.test(Us(s,E.line).text.slice(0,E.ch))&&ii(e,E.line,"smart")}}return ni(e),e.curOp.updateInput=y,e.curOp.typing=!0,o.length>1e3||o.indexOf("\n")>-1?t.value=e.display.prevInput="":e.display.prevInput=o,u&&An(e),e.state.pasteIncoming=e.state.cutIncoming=!1,!0}function Zn(e,t){var n,s,o=e.doc;if(e.somethingSelected()){e.display.prevInput="";var u=o.sel.primary();n=wu&&(u.to().line-u.from().line>100||(s=e.getSelection()).length>1e3);var a=n?"-":s||e.getSelection();e.display.input.value=a,e.state.focused&&Io(e.display.input),r&&i>=9&&(e.display.inputHasSelection=a)}else t||(e.display.prevInput=e.display.input.value="",r&&i>=9&&(e.display.inputHasSelection=null));e.display.inaccurateSelection=n}function er(e){e.options.readOnly!="nocursor"&&(!d||nu()!=e.display.input)&&e.display.input.focus()}function tr(e){e.state.focused||(er(e),Pr(e))}function nr(e){return e.options.readOnly||e.doc.cantEdit}function rr(e){function n(){e.state.focused&&setTimeout(Wo(er,e),0)}function o(t){To(e,t)||vo(t)}function u(n){if(e.somethingSelected())Gn=e.getSelections(),t.inaccurateSelection&&(t.prevInput="",t.inaccurateSelection=!1,t.input.value=Gn.join("\n"),Io(t.input));else{var r=[],i=[];for(var s=0;s<e.doc.sel.ranges.length;s++){var o=e.doc.sel.ranges[s].head.line,u={anchor:ht(o,0),head:ht(o+1,0)};i.push(u),r.push(e.getRange(u.anchor,u.head))}n.type=="cut"?e.setSelections(i,null,Oo):(t.prevInput="",t.input.value=r.join("\n"),Io(t.input)),Gn=r}n.type=="cut"&&(e.state.cutIncoming=!0)}var t=e.display;yo(t.scroller,"mousedown",jn(e,ur)),r&&i<11?yo(t.scroller,"dblclick",jn(e,function(t){if(To(e,t))return;var n=or(e,t);if(!n||dr(e,t)||sr(e.display,t))return;co(t);var r=e.findWordAt(n);kt(e.doc,r.anchor,r.head)})):yo(t.scroller,"dblclick",function(t){To(e,t)||co(t)}),yo(t.lineSpace,"selectstart",function(e){sr(t,e)||co(e)}),b||yo(t.scroller,"contextmenu",function(t){Br(e,t)}),yo(t.scroller,"scroll",function(){t.scroller.clientHeight&&(yr(e,t.scroller.scrollTop),br(e,t.scroller.scrollLeft,!0),wo(e,"scroll",e))}),yo(t.scrollbarV,"scroll",function(){t.scroller.clientHeight&&yr(e,t.scrollbarV.scrollTop)}),yo(t.scrollbarH,"scroll",function(){t.scroller.clientHeight&&br(e,t.scrollbarH.scrollLeft)}),yo(t.scroller,"mousewheel",function(t){Sr(e,t)}),yo(t.scroller,"DOMMouseScroll",function(t){Sr(e,t)}),yo(t.scrollbarH,"mousedown",n),yo(t.scrollbarV,"mousedown",n),yo(t.wrapper,"scroll",function(){t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),yo(t.input,"keyup",function(t){_r.call(e,t)}),yo(t.input,"input",function(){r&&i>=9&&e.display.inputHasSelection&&(e.display.inputHasSelection=null),Qn(e)}),yo(t.input,"keydown",jn(e,Or)),yo(t.input,"keypress",jn(e,Dr)),yo(t.input,"focus",Wo(Pr,e)),yo(t.input,"blur",Wo(Hr,e)),e.options.dragDrop&&(yo(t.scroller,"dragstart",function(t){gr(e,t)}),yo(t.scroller,"dragenter",o),yo(t.scroller,"dragover",o),yo(t.scroller,"drop",jn(e,mr))),yo(t.scroller,"paste",function(n){if(sr(t,n))return;e.state.pasteIncoming=!0,er(e),Qn(e)}),yo(t.input,"paste",function(){if(s&&!e.state.fakedLastChar&&!(new Date-e.state.lastMiddleDown<200)){var n=t.input.selectionStart,r=t.input.selectionEnd;t.input.value+="$",t.input.selectionEnd=r,t.input.selectionStart=n,e.state.fakedLastChar=!0}e.state.pasteIncoming=!0,Qn(e)}),yo(t.input,"cut",u),yo(t.input,"copy",u),l&&yo(t.sizer,"mouseup",function(){nu()==t.input&&t.input.blur(),er(e)})}function ir(e){var t=e.display;if(t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth)return;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,e.setSize()}function sr(e,t){for(var n=mo(t);n!=e.wrapper;n=n.parentNode)if(!n||n.ignoreEvents||n.parentNode==e.sizer&&n!=e.mover)return!0}function or(e,t,n,r){var i=e.display;if(!n){var s=mo(t);if(s==i.scrollbarH||s==i.scrollbarV||s==i.scrollbarFiller||s==i.gutterFiller)return null}var o,u,a=i.lineSpace.getBoundingClientRect();try{o=t.clientX-a.left,u=t.clientY-a.top}catch(t){return null}var f=wn(e,o,u),l;if(r&&f.xRel==1&&(l=Us(e.doc,f.line).text).length==f.ch){var c=Po(l,l.length,e.options.tabSize)-l.length;f=ht(f.line,Math.max(0,Math.round((o-Gt(e.display).left)/Tn(e.display))-c))}return f}function ur(e){if(To(this,e))return;var t=this,n=t.display;n.shift=e.shiftKey;if(sr(n,e)){s||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100));return}if(dr(t,e))return;var r=or(t,e);window.focus();switch(go(e)){case 1:r?lr(t,e,r):mo(e)==n.scroller&&co(e);break;case 2:s&&(t.state.lastMiddleDown=+(new Date)),r&&kt(t.doc,r),setTimeout(Wo(er,t),20),co(e);break;case 3:b&&Br(t,e)}}function lr(e,t,n){setTimeout(Wo(tr,e),0);var r=+(new Date),i;fr&&fr.time>r-400&&pt(fr.pos,n)==0?i="triple":ar&&ar.time>r-400&&pt(ar.pos,n)==0?(i="double",fr={time:r,pos:n}):(i="single",ar={time:r,pos:n});var s=e.doc.sel,o=v?t.metaKey:t.ctrlKey;e.options.dragDrop&&cu&&!nr(e)&&i=="single"&&s.contains(n)>-1&&s.somethingSelected()?cr(e,t,n,o):hr(e,t,n,i,o)}function cr(e,t,n,o){var u=e.display,a=jn(e,function(f){s&&(u.scroller.draggable=!1),e.state.draggingText=!1,bo(document,"mouseup",a),bo(u.scroller,"drop",a),Math.abs(t.clientX-f.clientX)+Math.abs(t.clientY-f.clientY)<10&&(co(f),o||kt(e.doc,n),er(e),r&&i==9&&setTimeout(function(){document.body.focus(),er(e)},20))});s&&(u.scroller.draggable=!0),e.state.draggingText=a,u.scroller.dragDrop&&u.scroller.dragDrop(),yo(document,"mouseup",a),yo(u.scroller,"drop",a)}function hr(e,t,n,r,i){function p(t){if(pt(h,t)==0)return;h=t;if(r=="rect"){var i=[],s=e.options.tabSize,l=Po(Us(o,n.line).text,n.ch,s),c=Po(Us(o,t.line).text,t.ch,s),p=Math.min(l,c),d=Math.max(l,c);for(var v=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));v<=m;v++){var g=Us(o,v).text,y=Ho(g,p,s);p==d?i.push(new yt(ht(v,y),ht(v,y))):g.length>y&&i.push(new yt(ht(v,y),ht(v,Ho(g,d,s))))}i.length||i.push(new yt(n,n)),Dt(o,bt(f.ranges.slice(0,a).concat(i),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,w=b.anchor,E=t;if(r!="single"){if(r=="double")var S=e.findWordAt(t);else var S=new yt(ht(t.line,0),St(o,ht(t.line+1,0)));pt(S.anchor,w)>0?(E=S.head,w=mt(b.from(),S.anchor)):(E=S.anchor,w=vt(b.to(),S.head))}var i=f.ranges.slice(0);i[a]=new yt(St(o,w),E),Dt(o,bt(i,a),Mo)}}function m(t){var n=++v,i=or(e,t,!0,r=="rect");if(!i)return;if(pt(i,h)!=0){tr(e),p(i);var u=I(s,o);(i.line>=u.to||i.line<u.from)&&setTimeout(jn(e,function(){v==n&&m(t)}),150)}else{var a=t.clientY<d.top?-20:t.clientY>d.bottom?20:0;a&&setTimeout(jn(e,function(){if(v!=n)return;s.scroller.scrollTop+=a,m(t)}),50)}}function g(t){v=Infinity,co(t),er(e),bo(document,"mousemove",y),bo(document,"mouseup",b),o.history.lastSelOrigin=null}var s=e.display,o=e.doc;co(t);var u,a,f=o.sel;i&&!t.shiftKey?(a=o.sel.contains(n),a>-1?u=o.sel.ranges[a]:u=new yt(n,n)):u=o.sel.primary();if(t.altKey)r="rect",i||(u=new yt(n,n)),n=or(e,t,!0,!0),a=-1;else if(r=="double"){var l=e.findWordAt(n);e.display.shift||o.extend?u=Ct(o,u,l.anchor,l.head):u=l}else if(r=="triple"){var c=new yt(ht(n.line,0),St(o,ht(n.line+1,0)));e.display.shift||o.extend?u=Ct(o,u,c.anchor,c.head):u=c}else u=Ct(o,u,n);i?a>-1?At(o,a,u,Mo):(a=o.sel.ranges.length,Dt(o,bt(o.sel.ranges.concat([u]),a),{scroll:!1,origin:"*mouse"})):(a=0,Dt(o,new gt([u],0),Mo),f=o.sel);var h=n,d=s.wrapper.getBoundingClientRect(),v=0,y=jn(e,function(e){go(e)?m(e):g(e)}),b=jn(e,g);yo(document,"mousemove",y),yo(document,"mouseup",b)}function pr(e,t,n,r,i){try{var s=t.clientX,o=t.clientY}catch(t){return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&co(t);var u=e.display,a=u.lineDiv.getBoundingClientRect();if(o>a.bottom||!Co(e,n))return po(t);o-=a.top-u.viewOffset;for(var f=0;f<e.options.gutters.length;++f){var l=u.gutters.childNodes[f];if(l&&l.getBoundingClientRect().right>=s){var c=$s(e.doc,o),h=e.options.gutters[f];return i(e,n,e,c,h,t),po(t)}}}function dr(e,t){return pr(e,t,"gutterClick",!0,So)}function mr(e){var t=this;if(To(t,e)||sr(t.display,e))return;co(e),r&&(vr=+(new Date));var n=or(t,e,!0),i=e.dataTransfer.files;if(!n||nr(t))return;if(i&&i.length&&window.FileReader&&window.File){var s=i.length,o=Array(s),u=0,a=function(e,r){var i=new FileReader;i.onload=jn(t,function(){o[r]=i.result;if(++u==s){n=St(t.doc,n);var e={from:n,to:n,text:yu(o.join("\n")),origin:"paste"};Wr(t.doc,e),_t(t.doc,wt(n,Fr(e)))}}),i.readAsText(e)};for(var f=0;f<s;++f)a(i[f],f)}else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(Wo(er,t),20);return}try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&(v?!e.metaKey:!e.ctrlKey))var l=t.listSelections();Pt(t.doc,wt(n,n));if(l)for(var f=0;f<l.length;++f)Qr(t.doc,"",l[f].anchor,l[f].head,"drag");t.replaceSelection(o,"around","paste"),er(t)}}catch(e){}}}function gr(e,t){if(r&&(!e.state.draggingText||+(new Date)-vr<100)){vo(t);return}if(To(e,t)||sr(e.display,t))return;t.dataTransfer.setData("Text",e.getSelection());if(t.dataTransfer.setDragImage&&!f){var n=Go("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",a&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),a&&n.parentNode.removeChild(n)}}function yr(t,n){if(Math.abs(t.doc.scrollTop-n)<2)return;t.doc.scrollTop=n,e||$(t,{top:n}),t.display.scroller.scrollTop!=n&&(t.display.scroller.scrollTop=n),t.display.scrollbarV.scrollTop!=n&&(t.display.scrollbarV.scrollTop=n),e&&$(t),Xt(t,100)}function br(e,t,n){if(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)return;t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,q(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbarH.scrollLeft!=t&&(e.display.scrollbarH.scrollLeft=t)}function Sr(t,n){var r=n.wheelDeltaX,i=n.wheelDeltaY;r==null&&n.detail&&n.axis==n.HORIZONTAL_AXIS&&(r=n.detail),i==null&&n.detail&&n.axis==n.VERTICAL_AXIS?i=n.detail:i==null&&(i=n.wheelDelta);var o=t.display,u=o.scroller;if(!(r&&u.scrollWidth>u.clientWidth||i&&u.scrollHeight>u.clientHeight))return;if(i&&v&&s)e:for(var f=n.target,l=o.view;f!=u;f=f.parentNode)for(var c=0;c<l.length;c++)if(l[c].node==f){t.display.currentWheelTarget=f;break e}if(r&&!e&&!a&&Er!=null){i&&yr(t,Math.max(0,Math.min(u.scrollTop+i*Er,u.scrollHeight-u.clientHeight))),br(t,Math.max(0,Math.min(u.scrollLeft+r*Er,u.scrollWidth-u.clientWidth))),co(n),o.wheelStartX=null;return}if(i&&Er!=null){var h=i*Er,p=t.doc.scrollTop,d=p+o.wrapper.clientHeight;h<0?p=Math.max(0,p+h-50):d=Math.min(t.doc.height,d+h+50),$(t,{top:p,bottom:d})}wr<20&&(o.wheelStartX==null?(o.wheelStartX=u.scrollLeft,o.wheelStartY=u.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){if(o.wheelStartX==null)return;var e=u.scrollLeft-o.wheelStartX,t=u.scrollTop-o.wheelStartY,n=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null;if(!n)return;Er=(Er*wr+n)/(wr+1),++wr},200)):(o.wheelDX+=r,o.wheelDY+=i))}function xr(e,t,n){if(typeof t=="string"){t=wi[t];if(!t)return!1}e.display.pollingFast&&Yn(e)&&(e.display.pollingFast=!1);var r=e.display.shift,i=!1;try{nr(e)&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ao}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Tr(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=xi(t,e.state.keyMaps[r],n);if(i)return i}return e.options.extraKeys&&xi(t,e.options.extraKeys,n)||xi(t,e.options.keyMap,n)}function Cr(e,t,n,r){var i=e.state.keySeq;if(i){if(Ti(t))return"handled";Nr.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,Zn(e))}),t=i+" "+t}var s=Tr(e,t,r);s=="multi"&&(e.state.keySeq=t),s=="handled"&&So(e,"keyHandled",e,t,n);if(s=="handled"||s=="multi")co(n),Wt(e);return i&&!s&&/\'$/.test(t)?(co(n),!0):!!s}function kr(e,t){var n=Ni(t,!0);return n?t.shiftKey&&!e.state.keySeq?Cr(e,"Shift-"+n,t,function(t){return xr(e,t,!0)})||Cr(e,n,t,function(t){if(typeof t=="string"?/^go[A-Z]/.test(t):t.motion)return xr(e,t)}):Cr(e,n,t,function(t){return xr(e,t)}):!1}function Lr(e,t,n){return Cr(e,"'"+n+"'",t,function(t){return xr(e,t,!0)})}function Or(e){var t=this;tr(t);if(To(t,e))return;r&&i<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var s=kr(t,e);a&&(Ar=s?n:null,!s&&n==88&&!wu&&(v?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Mr(t)}function Mr(e){function n(e){if(e.keyCode==18||!e.altKey)iu(t,"CodeMirror-crosshair"),bo(document,"keyup",n),bo(document,"mouseover",n)}var t=e.display.lineDiv;su(t,"CodeMirror-crosshair"),yo(document,"keyup",n),yo(document,"mouseover",n)}function _r(e){e.keyCode==16&&(this.doc.sel.shift=!1),To(this,e)}function Dr(e){var t=this;if(To(t,e)||e.ctrlKey&&!e.altKey||v&&e.metaKey)return;var n=e.keyCode,s=e.charCode;if(a&&n==Ar){Ar=null,co(e);return}if((a&&(!e.which||e.which<10)||l)&&kr(t,e))return;var o=String.fromCharCode(s==null?n:s);if(Lr(t,e,o))return;r&&i>=9&&(t.display.inputHasSelection=null),Qn(t)}function Pr(e){if(e.options.readOnly=="nocursor")return;e.state.focused||(wo(e,"focus",e),e.state.focused=!0,su(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(Zn(e),s&&setTimeout(Wo(Zn,e,!0),0))),Kn(e),Wt(e)}function Hr(e){e.state.focused&&(wo(e,"blur",e),e.state.focused=!1,iu(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Br(e,t){function h(){if(n.input.selectionStart!=null){var t=e.somethingSelected(),r=n.input.value=""+(t?n.input.value:"");n.prevInput=t?"":"",n.input.selectionStart=1,n.input.selectionEnd=r.length,n.selForContextMenu=e.doc.sel}}function p(){n.inputDiv.style.position="relative",n.input.style.cssText=l,r&&i<9&&(n.scrollbarV.scrollTop=n.scroller.scrollTop=u),Kn(e);if(n.input.selectionStart!=null){(!r||r&&i<9)&&h();var t=0,s=function(){n.selForContextMenu==e.doc.sel&&n.input.selectionStart==0?jn(e,wi.selectAll)(e):t++<10?n.detectingSelectAll=setTimeout(s,500):Zn(e)};n.detectingSelectAll=setTimeout(s,200)}}if(To(e,t,"contextmenu"))return;var n=e.display;if(sr(n,t)||jr(e,t))return;var o=or(e,t),u=n.scroller.scrollTop;if(!o||a)return;var f=e.options.resetSelectionOnContextMenu;f&&e.doc.sel.contains(o)==-1&&jn(e,Dt)(e.doc,wt(o),Oo);var l=n.input.style.cssText;n.inputDiv.style.position="absolute",n.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(t.clientY-5)+"px; left: "+(t.clientX-5)+"px; z-index: 1000; background: "+(r?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(s)var c=window.scrollY;er(e),s&&window.scrollTo(null,c),Zn(e),e.somethingSelected()||(n.input.value=n.prevInput=" "),n.selForContextMenu=e.doc.sel,clearTimeout(n.detectingSelectAll),r&&i>=9&&h();if(b){vo(t);var d=function(){bo(window,"mouseup",d),setTimeout(p,20)};yo(window,"mouseup",d)}else setTimeout(p,50)}function jr(e,t){return Co(e,"gutterContextMenu")?pr(e,t,"gutterContextMenu",!1,wo):!1}function Ir(e,t){if(pt(e,t.from)<0)return e;if(pt(e,t.to)<=0)return Fr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Fr(t).ch-t.to.ch),ht(n,r)}function qr(e,t){var n=[];for(var r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new yt(Ir(i.anchor,t),Ir(i.head,t)))}return bt(n,e.sel.primIndex)}function Rr(e,t,n){return e.line==t.line?ht(n.line,e.ch-t.ch+n.ch):ht(n.line+(e.line-t.line),e.ch)}function Ur(e,t,n){var r=[],i=ht(e.first,0),s=i;for(var o=0;o<t.length;o++){var u=t[o],a=Rr(u.from,i,s),f=Rr(Fr(u),i,s);i=u.to,s=f;if(n=="around"){var l=e.sel.ranges[o],c=pt(l.head,l.anchor)<0;r[o]=new yt(c?f:a,c?a:f)}else r[o]=new yt(a,a)}return new gt(r,e.sel.primIndex)}function zr(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return n&&(r.update=function(t,n,r,i){t&&(this.from=St(e,t)),n&&(this.to=St(e,n)),r&&(this.text=r),i!==undefined&&(this.origin=i)}),wo(e,"beforeChange",e,r),e.cm&&wo(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Wr(e,t,n){if(e.cm){if(!e.cm.curOp)return jn(e.cm,Wr)(e,t,n);if(e.cm.state.suppressEdits)return}if(Co(e,"beforeChange")||e.cm&&Co(e.cm,"beforeChange")){t=zr(e,t,!0);if(!t)return}var r=w&&!n&&Xi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Xr(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else Xr(e,t)}function Xr(e,t){if(t.text.length==1&&t.text[0]==""&&pt(t.from,t.to)==0)return;var n=qr(e,t);eo(e,t,n,e.cm?e.cm.curOp.id:NaN),Jr(e,t,n,Ui(e,t));var r=[];qs(e,function(e,n){!n&&qo(r,e.history)==-1&&(lo(e.history,t),r.push(e.history)),Jr(e,t,null,Ui(e,t))})}function Vr(e,t,n){if(e.cm&&e.cm.state.suppressEdits)return;var r=e.history,i,s=e.sel,o=t=="undo"?r.done:r.undone,u=t=="undo"?r.undone:r.done;for(var a=0;a<o.length;a++){i=o[a];if(n?i.ranges&&!i.equals(e.sel):!i.ranges)break}if(a==o.length)return;r.lastOrigin=r.lastSelOrigin=null;for(;;){i=o.pop();if(!i.ranges)break;ro(i,u);if(n&&!i.equals(e.sel)){Dt(e,i,{clearRedo:!1});return}s=i}var f=[];ro(s,u),u.push({changes:f,generation:r.generation}),r.generation=i.generation||++r.maxGeneration;var l=Co(e,"beforeChange")||e.cm&&Co(e.cm,"beforeChange");for(var a=i.changes.length-1;a>=0;--a){var c=i.changes[a];c.origin=t;if(l&&!zr(e,c,!1)){o.length=0;return}f.push(Gs(e,c));var h=a?qr(e,c):Fo(o);Jr(e,c,h,Wi(e,c)),!a&&e.cm&&e.cm.scrollIntoView({from:c.from,to:Fr(c)});var p=[];qs(e,function(e,t){!t&&qo(p,e.history)==-1&&(lo(e.history,c),p.push(e.history)),Jr(e,c,null,Wi(e,c))})}}function $r(e,t){if(t==0)return;e.first+=t,e.sel=new gt(Ro(e.sel.ranges,function(e){return new yt(ht(e.anchor.line+t,e.anchor.ch),ht(e.head.line+t,e.head.ch))}),e.sel.primIndex);if(e.cm){Un(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)zn(e.cm,r,"gutter")}}function Jr(e,t,n,r){if(e.cm&&!e.cm.curOp)return jn(e.cm,Jr)(e,t,n,r);if(t.to.line<e.first){$r(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);$r(e,i),t={from:ht(e.first,0),to:ht(t.to.line+i,t.to.ch),text:[Fo(t.text)],origin:t.origin}}var s=e.lastLine();t.to.line>s&&(t={from:t.from,to:ht(s,Us(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=zs(e,t.from,t.to),n||(n=qr(e,t)),e.cm?Kr(e.cm,t,r):Ds(e,t,r),Pt(e,n,Oo)}function Kr(e,t,n){var r=e.doc,i=e.display,s=t.from,o=t.to,u=!1,a=s.line;e.options.lineWrapping||(a=Vs(ts(Us(r,s.line))),r.iter(a,o.line+1,function(e){if(e==i.maxLine)return u=!0,!0})),r.sel.contains(t.from,t.to)>-1&&No(e),Ds(r,t,n,k(e)),e.options.lineWrapping||(r.iter(a,s.line+t.text.length,function(e){var t=D(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,u=!1)}),u&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,s.line),Xt(e,400);var f=t.text.length-(o.line-s.line)-1;s.line==o.line&&t.text.length==1&&!_s(e.doc,t)?zn(e,s.line,"text"):Un(e,s.line,o.line+1,f);var l=Co(e,"changes"),c=Co(e,"change");if(c||l){var h={from:s,to:o,text:t.text,removed:t.removed,origin:t.origin};c&&So(e,"change",e,h),l&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function Qr(e,t,n,r,i){r||(r=n);if(pt(r,n)<0){var s=r;r=n,n=s}typeof t=="string"&&(t=yu(t)),Wr(e,{from:n,to:r,text:t,origin:i})}function Gr(e,t){if(To(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1);if(i!=null&&!h){var s=Go("div","",null,"position: absolute; top: "+(t.top-n.viewOffset-Kt(e.display))+"px; height: "+(t.bottom-t.top+Lo)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(i),e.display.lineSpace.removeChild(s)}}function Yr(e,t,n,r){r==null&&(r=0);for(var i=0;i<5;i++){var s=!1,o=gn(e,t),u=!n||n==t?o:gn(e,n),a=ei(e,Math.min(o.left,u.left),Math.min(o.top,u.top)-r,Math.max(o.left,u.left),Math.max(o.bottom,u.bottom)+r),f=e.doc.scrollTop,l=e.doc.scrollLeft;a.scrollTop!=null&&(yr(e,a.scrollTop),Math.abs(e.doc.scrollTop-f)>1&&(s=!0)),a.scrollLeft!=null&&(br(e,a.scrollLeft),Math.abs(e.doc.scrollLeft-l)>1&&(s=!0));if(!s)return o}}function Zr(e,t,n,r,i){var s=ei(e,t,n,r,i);s.scrollTop!=null&&yr(e,s.scrollTop),s.scrollLeft!=null&&br(e,s.scrollLeft)}function ei(e,t,n,r,i){var s=e.display,o=xn(e.display);n<0&&(n=0);var u=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:s.scroller.scrollTop,a=s.scroller.clientHeight-Lo,f={};i-n>a&&(i=n+a);var l=e.doc.height+Qt(s),c=n<o,h=i>l-o;if(n<u)f.scrollTop=c?0:n;else if(i>u+a){var p=Math.min(n,(h?l:i)-a);p!=u&&(f.scrollTop=p)}var d=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:s.scroller.scrollLeft,v=s.scroller.clientWidth-Lo-s.gutters.offsetWidth,m=r-t>v;return m&&(r=t+v),t<10?f.scrollLeft=0:t<d?f.scrollLeft=Math.max(0,t-(m?0:10)):r>v+d-3&&(f.scrollLeft=r+(m?0:10)-v),f}function ti(e,t,n){(t!=null||n!=null)&&ri(e),t!=null&&(e.curOp.scrollLeft=(e.curOp.scrollLeft==null?e.doc.scrollLeft:e.curOp.scrollLeft)+t),n!=null&&(e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+n)}function ni(e){ri(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?ht(t.line,t.ch-1):t,r=ht(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function ri(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=yn(e,t.from),r=yn(e,t.to),i=ei(e,Math.min(n.left,r.left),Math.min(n.top,r.top)-t.margin,Math.max(n.right,r.right),Math.max(n.bottom,r.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function ii(e,t,n,r){var i=e.doc,s;n==null&&(n="add"),n=="smart"&&(i.mode.indent?s=Jt(e,t):n="prev");var o=e.options.tabSize,u=Us(i,t),a=Po(u.text,null,o);u.stateAfter&&(u.stateAfter=null);var f=u.text.match(/^\s*/)[0],l;if(!r&&!/\S/.test(u.text))l=0,n="not";else if(n=="smart"){l=i.mode.indent(s,u.text.slice(f.length),u.text);if(l==Ao||l>150){if(!r)return;n="prev"}}n=="prev"?t>i.first?l=Po(Us(i,t-1).text,null,o):l=0:n=="add"?l=a+e.options.indentUnit:n=="subtract"?l=a-e.options.indentUnit:typeof n=="number"&&(l=a+n),l=Math.max(0,l);var c="",h=0;if(e.options.indentWithTabs)for(var p=Math.floor(l/o);p;--p)h+=o,c+=" ";h<l&&(c+=jo(l-h));if(c!=f)Qr(i,c,ht(t,0),ht(t,f.length),"+input");else for(var p=0;p<i.sel.ranges.length;p++){var d=i.sel.ranges[p];if(d.head.line==t&&d.head.ch<f.length){var h=ht(t,f.length);At(i,p,new yt(h,h));break}}u.stateAfter=null}function si(e,t,n,r){var i=t,s=t;return typeof t=="number"?s=Us(e,Et(e,t)):i=Vs(t),i==null?null:(r(s,i)&&e.cm&&zn(e.cm,i,n),s)}function oi(e,t){var n=e.doc.sel.ranges,r=[];for(var i=0;i<n.length;i++){var s=t(n[i]);while(r.length&&pt(s.from,Fo(r).to)<=0){var o=r.pop();if(pt(o.from,s.from)<0){s.from=o.from;break}}r.push(s)}Bn(e,function(){for(var t=r.length-1;t>=0;t--)Qr(e.doc,"",r[t].from,r[t].to,"+delete");ni(e)})}function ui(e,t,n,r,i){function l(){var t=s+n;return t<e.first||t>=e.first+e.size?f=!1:(s=t,a=Us(e,t))}function c(e){var t=(i?Bu:ju)(a,o,n,!0);if(t==null){if(!!e||!l())return f=!1;i?o=(n<0?Lu:ku)(a):o=n<0?a.text.length:0}else o=t;return!0}var s=t.line,o=t.ch,u=n,a=Us(e,s),f=!0;if(r=="char")c();else if(r=="column")c(!0);else if(r=="word"||r=="group"){var h=null,p=r=="group",d=e.cm&&e.cm.getHelper(t,"wordChars");for(var v=!0;;v=!1){if(n<0&&!c(!v))break;var m=a.text.charAt(o)||"\n",g=$o(m,d)?"w":p&&m=="\n"?"n":!p||/\s/.test(m)?null:"p";p&&!v&&!g&&(g="s");if(h&&h!=g){n<0&&(n=1,c());break}g&&(h=g);if(n>0&&!c(!v))break}}var y=Ft(e,ht(s,o),u,!0);return f||(y.hitSide=!0),y}function ai(e,t,n,r){var i=e.doc,s=t.left,o;if(r=="page"){var u=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);o=t.top+n*(u-(n<0?1.5:.5)*xn(e.display))}else r=="line"&&(o=n>0?t.bottom+3:t.top-3);for(;;){var a=wn(e,s,o);if(!a.outside)break;if(n<0?o<=0:o>=i.height){a.hitSide=!0;break}o+=n*5}return a}function ci(e,t,n,r){S.defaults[e]=t,n&&(li[e]=r?function(e,t,r){r!=hi&&n(e,t,r)}:n)}function Si(e){var t=e.split(/-(?!$)/),e=t[t.length-1],n,r,i,s;for(var o=0;o<t.length-1;o++){var u=t[o];if(/^(cmd|meta|m)$/i.test(u))s=!0;else if(/^a(lt)?$/i.test(u))n=!0;else if(/^(c|ctrl|control)$/i.test(u))r=!0;else{if(!/^s(hift)$/i.test(u))throw new Error("Unrecognized modifier name: "+u);i=!0}}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),s&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ci(e){return typeof e=="string"?Ei[e]:e}function Oi(e,t,n,r,i){if(r&&r.shared)return _i(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return jn(e.cm,Oi)(e,t,n,r,i);var s=new Li(e,i),o=pt(t,n);r&&zo(r,s,!1);if(o>0||o==0&&s.clearWhenEmpty!==!1)return s;s.replacedWith&&(s.collapsed=!0,s.widgetNode=Go("span",[s.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||(s.widgetNode.ignoreEvents=!0),r.insertLeft&&(s.widgetNode.insertLeft=!0));if(s.collapsed){if(es(e,t.line,t,n,s)||t.line!=n.line&&es(e,n.line,t,n,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");E=!0}s.addToHistory&&eo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var u=t.line,a=e.cm,f;e.iter(u,n.line+1,function(e){a&&s.collapsed&&!a.options.lineWrapping&&ts(e)==a.display.maxLine&&(f=!0),s.collapsed&&u!=t.line&&Xs(e,0),Ii(e,new Bi(s,u==t.line?t.ch:null,u==n.line?n.ch:null)),++u}),s.collapsed&&e.iter(t.line,n.line+1,function(t){ss(e,t)&&Xs(t,0)}),s.clearOnEnter&&yo(s,"beforeCursorEnter",function(){s.clear()}),s.readOnly&&(w=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++Ai,s.atomic=!0);if(a){f&&(a.curOp.updateMaxLine=!0);if(s.collapsed)Un(a,t.line,n.line+1);else if(s.className||s.title||s.startStyle||s.endStyle)for(var l=t.line;l<=n.line;l++)zn(a,l,"text");s.atomic&&Bt(a.doc),So(a,"markerAdded",a,s)}return s}function _i(e,t,n,r,i){r=zo(r),r.shared=!1;var s=[Oi(e,t,n,r,i)],o=s[0],u=r.widgetNode;return qs(e,function(e){u&&(r.widgetNode=u.cloneNode(!0)),s.push(Oi(e,St(e,t),St(e,n),r,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;o=Fo(s)}),new Mi(s,o)}function Di(e){return e.findMarks(ht(e.first,0),e.clipPos(ht(e.lastLine())),function(e){return e.parent})}function Pi(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),s=e.clipPos(i.from),o=e.clipPos(i.to);if(pt(s,o)){var u=Oi(e,s,o,r.primary,r.primary.type);r.markers.push(u),u.parent=r}}}function Hi(e){for(var t=0;t<e.length;t++){var n=e[t],r=[n.primary.doc];qs(n.primary.doc,function(e){r.push(e)});for(var i=0;i<n.markers.length;i++){var s=n.markers[i];qo(r,s.doc)==-1&&(s.parent=null,n.markers.splice(i--,1))}}}function Bi(e,t,n){this.marker=e,this.from=t,this.to=n}function ji(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Fi(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Ii(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function qi(e,t,n){if(e)for(var r=0,i;r<e.length;++r){var s=e[r],o=s.marker,u=s.from==null||(o.inclusiveLeft?s.from<=t:s.from<t);if(u||s.from==t&&o.type=="bookmark"&&(!n||!s.marker.insertLeft)){var a=s.to==null||(o.inclusiveRight?s.to>=t:s.to>t);(i||(i=[])).push(new Bi(o,s.from,a?null:s.to))}}return i}function Ri(e,t,n){if(e)for(var r=0,i;r<e.length;++r){var s=e[r],o=s.marker,u=s.to==null||(o.inclusiveRight?s.to>=t:s.to>t);if(u||s.from==t&&o.type=="bookmark"&&(!n||s.marker.insertLeft)){var a=s.from==null||(o.inclusiveLeft?s.from<=t:s.from<t);(i||(i=[])).push(new Bi(o,a?null:s.from-t,s.to==null?null:s.to-t))}}return i}function Ui(e,t){var n=Tt(e,t.from.line)&&Us(e,t.from.line).markedSpans,r=Tt(e,t.to.line)&&Us(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,s=t.to.ch,o=pt(t.from,t.to)==0,u=qi(n,i,o),a=Ri(r,s,o),f=t.text.length==1,l=Fo(t.text).length+(f?i:0);if(u)for(var c=0;c<u.length;++c){var h=u[c];if(h.to==null){var p=ji(a,h.marker);p?f&&(h.to=p.to==null?null:p.to+l):h.to=i}}if(a)for(var c=0;c<a.length;++c){var h=a[c];h.to!=null&&(h.to+=l);if(h.from==null){var p=ji(u,h.marker);p||(h.from=l,f&&(u||(u=[])).push(h))}else h.from+=l,f&&(u||(u=[])).push(h)}u&&(u=zi(u)),a&&a!=u&&(a=zi(a));var d=[u];if(!f){var v=t.text.length-2,m;if(v>0&&u)for(var c=0;c<u.length;++c)u[c].to==null&&(m||(m=[])).push(new Bi(u[c].marker,null,null));for(var c=0;c<v;++c)d.push(m);d.push(a)}return d}function zi(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Wi(e,t){var n=oo(e,t),r=Ui(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var s=n[i],o=r[i];if(s&&o)e:for(var u=0;u<o.length;++u){var a=o[u];for(var f=0;f<s.length;++f)if(s[f].marker==a.marker)continue e;s.push(a)}else o&&(n[i]=o)}return n}function Xi(e,t,n){var r=null;e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;n.readOnly&&(!r||qo(r,n)==-1)&&(r||(r=[])).push(n)}});if(!r)return null;var i=[{from:t,to:n}];for(var s=0;s<r.length;++s){var o=r[s],u=o.find(0);for(var a=0;a<i.length;++a){var f=i[a];if(pt(f.to,u.from)<0||pt(f.from,u.to)>0)continue;var l=[a,1],c=pt(f.from,u.from),h=pt(f.to,u.to);(c<0||!o.inclusiveLeft&&!c)&&l.push({from:f.from,to:u.from}),(h>0||!o.inclusiveRight&&!h)&&l.push({from:u.to,to:f.to}),i.splice.apply(i,l),a+=l.length-1}}return i}function Vi(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function $i(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function Ji(e){return e.inclusiveLeft?-1:0}function Ki(e){return e.inclusiveRight?1:0}function Qi(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),s=pt(r.from,i.from)||Ji(e)-Ji(t);if(s)return-s;var o=pt(r.to,i.to)||Ki(e)-Ki(t);return o?o:t.id-e.id}function Gi(e,t){var n=E&&e.markedSpans,r;if(n)for(var i,s=0;s<n.length;++s)i=n[s],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Qi(r,i.marker)<0)&&(r=i.marker);return r}function Yi(e){return Gi(e,!0)}function Zi(e){return Gi(e,!1)}function es(e,t,n,r,i){var s=Us(e,t),o=E&&s.markedSpans;if(o)for(var u=0;u<o.length;++u){var a=o[u];if(!a.marker.collapsed)continue;var f=a.marker.find(0),l=pt(f.from,n)||Ji(a.marker)-Ji(i),c=pt(f.to,r)||Ki(a.marker)-Ki(i);if(l>=0&&c<=0||l<=0&&c>=0)continue;if(l<=0&&(pt(f.to,n)>0||a.marker.inclusiveRight&&i.inclusiveLeft)||l>=0&&(pt(f.from,r)<0||a.marker.inclusiveLeft&&i.inclusiveRight))return!0}}function ts(e){var t;while(t=Yi(e))e=t.find(-1,!0).line;return e}function ns(e){var t,n;while(t=Zi(e))e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function rs(e,t){var n=Us(e,t),r=ts(n);return n==r?t:Vs(r)}function is(e,t){if(t>e.lastLine())return t;var n=Us(e,t),r;if(!ss(e,n))return t;while(r=Zi(n))n=r.find(1,!0).line;return Vs(n)+1}function ss(e,t){var n=E&&t.markedSpans;if(n)for(var r,i=0;i<n.length;++i){r=n[i];if(!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&os(e,t,r))return!0}}function os(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return os(e,r.line,ji(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i,s=0;s<t.markedSpans.length;++s){i=t.markedSpans[s];if(i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&os(e,t,i))return!0}}function as(e,t,n){Js(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ti(e,null,n)}function fs(e){if(e.height!=null)return e.height;if(!tu(document.body,e.node)){var t="position: relative;";e.coverGutter&&(t+="margin-left: -"+e.cm.getGutterElement().offsetWidth+"px;"),eu(e.cm.display.measure,Go("div",[e.node],null,t))}return e.height=e.node.offsetHeight}function ls(e,t,n,r){var i=new us(e,n,r);return i.noHScroll&&(e.display.alignWidgets=!0),si(e.doc,t,"widget",function(t){var n=t.widgets||(t.widgets=[]);i.insertAt==null?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i),i.line=t;if(!ss(e.doc,t)){var r=Js(t)<e.doc.scrollTop;Xs(t,t.height+fs(i)),r&&ti(e,null,i.height),e.curOp.forceUpdate=!0}return!0}),i}function hs(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Vi(e),$i(e,n);var i=r?r(e):1;i!=e.height&&Xs(e,i)}function ps(e){e.parent=null,Vi(e)}function ds(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:(new RegExp("(?:^|s)"+n[2]+"(?:$|s)")).test(t[r])||(t[r]+=" "+n[2])}return e}function vs(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=S.innerMode(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function ms(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=S.innerMode(e,n).mode);var s=e.token(t,n);if(t.pos>t.start)return s}throw new Error("Mode "+e.name+" failed to advance stream.")}function gs(e,t,n,r){function i(e){return{start:l.start,end:l.pos,string:l.current(),type:u||null,state:e?yi(s.mode,f):f}}var s=e.doc,o=s.mode,u;t=St(s,t);var a=Us(s,t.line),f=Jt(e,t.line,n),l=new ki(a.text,e.options.tabSize),c;r&&(c=[]);while((r||l.pos<t.ch)&&!l.eol())l.start=l.pos,u=ms(o,l,f),r&&c.push(i(!0));return r?c:i()}function ys(e,t,n,r,i,s,o){var u=n.flattenSpans;u==null&&(u=e.options.flattenSpans);var a=0,f=null,l=new ki(t,e.options.tabSize),c,h=e.options.addModeClass&&[null];t==""&&ds(vs(n,r),s);while(!l.eol()){l.pos>e.options.maxHighlightLength?(u=!1,o&&Es(e,t,r,l.pos),l.pos=t.length,c=null):c=ds(ms(n,l,r,h),s);if(h){var p=h[0].name;p&&(c="m-"+(c?p+" "+c:p))}if(!u||f!=c)a<l.start&&i(l.start,f),a=l.start,f=c;l.start=l.pos}while(a<l.pos){var d=Math.min(l.pos,a+5e4);i(d,f),a=d}}function bs(e,t,n,r){var i=[e.state.modeGen],s={};ys(e,t.text,e.doc.mode,n,function(e,t){i.push(e,t)},s,r);for(var o=0;o<e.state.overlays.length;++o){var u=e.state.overlays[o],a=1,f=0;ys(e,t.text,u.mode,!0,function(e,t){var n=a;while(f<e){var r=i[a];r>e&&i.splice(a,1,e,i[a+1],r),a+=2,f=Math.min(e,r)}if(!t)return;if(u.opaque)i.splice(n,a-n,e,"cm-overlay "+t),a=n+2;else for(;n<a;n+=2){var s=i[n+1];i[n+1]=(s?s+" ":"")+"cm-overlay "+t}},s)}return{styles:i,classes:s.bgClass||s.textClass?s:null}}function ws(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=bs(e,t,t.stateAfter=Jt(e,Vs(t)));t.styles=r.styles,r.classes?t.styleClasses=r.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++}return t.styles}function Es(e,t,n,r){var i=e.doc.mode,s=new ki(t,e.options.tabSize);s.start=s.pos=r||0,t==""&&vs(i,n);while(!s.eol()&&s.pos<=e.options.maxHighlightLength)ms(i,s,n),s.start=s.pos}function Ts(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?xs:Ss;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ns(e,t){var n=Go("span",null,null,s?"padding-right: .1px":null),i={pre:Go("pre",[n]),content:n,col:0,pos:0,cm:e};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var u=o?t.rest[o-1]:t.line,a;i.pos=0,i.addToken=ks,(r||s)&&e.getOption("lineWrapping")&&(i.addToken=Ls(i.addToken)),gu(e.display.measure)&&(a=Ks(u))&&(i.addToken=As(i.addToken,a)),i.map=[];var f=t!=e.display.externalMeasured&&Vs(u);Ms(u,i,ws(e,u,f)),u.styleClasses&&(u.styleClasses.bgClass&&(i.bgClass=ou(u.styleClasses.bgClass,i.bgClass||"")),u.styleClasses.textClass&&(i.textClass=ou(u.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(vu(e.display.measure))),o==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return s&&/\bcm-tab\b/.test(i.content.lastChild.className)&&(i.content.className="cm-tab-wrap-hack"),wo(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=ou(i.pre.className,i.textClass||"")),i}function Cs(e){var t=Go("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t}function ks(e,t,n,s,o,u){if(!t)return;var a=e.cm.options.specialChars,f=!1;if(!a.test(t)){e.col+=t.length;var l=document.createTextNode(t);e.map.push(e.pos,e.pos+t.length,l),r&&i<9&&(f=!0),e.pos+=t.length}else{var l=document.createDocumentFragment(),c=0;for(;;){a.lastIndex=c;var h=a.exec(t),p=h?h.index-c:t.length-c;if(p){var d=document.createTextNode(t.slice(c,c+p));r&&i<9?l.appendChild(Go("span",[d])):l.appendChild(d),e.map.push(e.pos,e.pos+p,d),e.col+=p,e.pos+=p}if(!h)break;c+=p+1;if(h[0]==" "){var v=e.cm.options.tabSize,m=v-e.col%v,d=l.appendChild(Go("span",jo(m),"cm-tab"));e.col+=m}else{var d=e.cm.options.specialCharPlaceholder(h[0]);r&&i<9?l.appendChild(Go("span",[d])):l.appendChild(d),e.col+=1}e.map.push(e.pos,e.pos+1,d),e.pos++}}if(n||s||o||f){var g=n||"";s&&(g+=s),o&&(g+=o);var y=Go("span",[l],g);return u&&(y.title=u),e.content.appendChild(y)}e.content.appendChild(l)}function Ls(e){function t(e){var t=" ";for(var n=0;n<e.length-2;++n)t+=n%2?" ":" ";return t+=" ",t}return function(n,r,i,s,o,u){e(n,r.replace(/ {3,}/g,t),i,s,o,u)}}function As(e,t){return function(n,r,i,s,o,u){i=i?i+" cm-force-border":"cm-force-border";var a=n.pos,f=a+r.length;for(;;){for(var l=0;l<t.length;l++){var c=t[l];if(c.to>a&&c.from<=a)break}if(c.to>=f)return e(n,r,i,s,o,u);e(n,r.slice(0,c.to-a),i,s,null,u),s=null,r=r.slice(c.to-a),a=c.to}}}function Os(e,t,n,r){var i=!r&&n.widgetNode;i&&(e.map.push(e.pos,e.pos+t,i),e.content.appendChild(i)),e.pos+=t}function Ms(e,t,n){var r=e.markedSpans,i=e.text,s=0;if(!r){for(var o=1;o<n.length;o+=2)t.addToken(t,i.slice(s,s=n[o]),Ts(n[o+1],t.cm.options));return}var u=i.length,a=0,o=1,f="",l,c=0,h,p,d,v,m;for(;;){if(c==a){h=p=d=v="",m=null,c=Infinity;var g=[];for(var y=0;y<r.length;++y){var b=r[y],w=b.marker;b.from<=a&&(b.to==null||b.to>a)?(b.to!=null&&c>b.to&&(c=b.to,p=""),w.className&&(h+=" "+w.className),w.startStyle&&b.from==a&&(d+=" "+w.startStyle),w.endStyle&&b.to==c&&(p+=" "+w.endStyle),w.title&&!v&&(v=w.title),w.collapsed&&(!m||Qi(m.marker,w)<0)&&(m=b)):b.from>a&&c>b.from&&(c=b.from),w.type=="bookmark"&&b.from==a&&w.widgetNode&&g.push(w)}if(m&&(m.from||0)==a){Os(t,(m.to==null?u+1:m.to)-a,m.marker,m.from==null);if(m.to==null)return}if(!m&&g.length)for(var y=0;y<g.length;++y)Os(t,0,g[y])}if(a>=u)break;var E=Math.min(u,c);for(;;){if(f){var S=a+f.length;if(!m){var x=S>E?f.slice(0,E-a):f;t.addToken(t,x,l?l+h:h,d,a+x.length==c?p:"",v)}if(S>=E){f=f.slice(E-a),a=E;break}a=S,d=""}f=i.slice(s,s=n[o++]),l=Ts(n[o++],t.cm.options)}}}function _s(e,t){return t.from.ch==0&&t.to.ch==0&&Fo(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ds(e,t,n,r){function i(e){return n?n[e]:null}function s(e,n,i){hs(e,n,i,r),So(e,"change",e,t)}var o=t.from,u=t.to,a=t.text,f=Us(e,o.line),l=Us(e,u.line),c=Fo(a),h=i(a.length-1),p=u.line-o.line;if(_s(e,t)){for(var d=0,v=[];d<a.length-1;++d)v.push(new cs(a[d],i(d),r));s(l,l.text,h),p&&e.remove(o.line,p),v.length&&e.insert(o.line,v)}else if(f==l)if(a.length==1)s(f,f.text.slice(0,o.ch)+c+f.text.slice(u.ch),h);else{for(var v=[],d=1;d<a.length-1;++d)v.push(new cs(a[d],i(d),r));v.push(new cs(c+f.text.slice(u.ch),h,r)),s(f,f.text.slice(0,o.ch)+a[0],i(0)),e.insert(o.line+1,v)}else if(a.length==1)s(f,f.text.slice(0,o.ch)+a[0]+l.text.slice(u.ch),i(0)),e.remove(o.line+1,p);else{s(f,f.text.slice(0,o.ch)+a[0],i(0)),s(l,c+l.text.slice(u.ch),h);for(var d=1,v=[];d<a.length-1;++d)v.push(new cs(a[d],i(d),r));p>1&&e.remove(o.line+1,p-1),e.insert(o.line+1,v)}So(e,"change",e,t)}function Ps(e){this.lines=e,this.parent=null;for(var t=0,n=0;t<e.length;++t)e[t].parent=this,n+=e[t].height;this.height=n}function Hs(e){this.children=e;var t=0,n=0;for(var r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}function qs(e,t,n){function r(e,i,s){if(e.linked)for(var o=0;o<e.linked.length;++o){var u=e.linked[o];if(u.doc==i)continue;var a=s&&u.sharedHist;if(n&&!a)continue;t(u.doc,a),r(u.doc,e,a)}}r(e,null,!0)}function Rs(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,L(e),T(e),e.options.lineWrapping||P(e),e.options.mode=t.modeOption,Un(e)}function Us(e,t){t-=e.first;if(t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],s=i.chunkSize();if(t<s){n=i;break}t-=s}return n.lines[t]}function zs(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var s=e.text;i==n.line&&(s=s.slice(0,n.ch)),i==t.line&&(s=s.slice(t.ch)),r.push(s),++i}),r}function Ws(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function Xs(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Vs(e){if(e.parent==null)return null;var t=e.parent,n=qo(t.lines,e);for(var r=t.parent;r;t=r,r=r.parent)for(var i=0;;++i){if(r.children[i]==t)break;n+=r.children[i].chunkSize()}return n+t.first}function $s(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],s=i.height;if(t<s){e=i;continue e}t-=s,n+=i.chunkSize()}return n}while(!e.lines);for(var r=0;r<e.lines.length;++r){var o=e.lines[r],u=o.height;if(t<u)break;t-=u}return n+r}function Js(e){e=ts(e);var t=0,n=e.parent;for(var r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var s=n.parent;s;n=s,s=n.parent)for(var r=0;r<s.children.length;++r){var o=s.children[r];if(o==n)break;t+=o.height}return t}function Ks(e){var t=e.order;return t==null&&(t=e.order=Fu(e.text)),t}function Qs(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Gs(e,t){var n={from:dt(t.from),to:Fr(t),text:zs(e,t.from,t.to)};return io(e,n,t.from.line,t.to.line+1),qs(e,function(e){io(e,n,t.from.line,t.to.line+1)},!0),n}function Ys(e){while(e.length){var t=Fo(e);if(!t.ranges)break;e.pop()}}function Zs(e,t){if(t)return Ys(e.done),Fo(e.done);if(e.done.length&&!Fo(e.done).ranges)return Fo(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Fo(e.done)}function eo(e,t,n,r){var i=e.history;i.undone.length=0;var s=+(new Date),o;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&e.cm&&i.lastModTime>s-e.cm.options.historyEventDelay||t.origin.charAt(0)=="*"))&&(o=Zs(i,i.lastOp==r))){var u=Fo(o.changes);pt(t.from,t.to)==0&&pt(t.from,u.to)==0?u.to=Fr(t):o.changes.push(Gs(e,t))}else{var a=Fo(i.done);(!a||!a.ranges)&&ro(e.sel,i.done),o={changes:[Gs(e,t)],generation:i.generation},i.done.push(o);while(i.done.length>i.undoDepth)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,u||wo(e,"historyAdded")}function to(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function no(e,t,n,r){var i=e.history,s=r&&r.origin;n==i.lastSelOp||s&&i.lastSelOrigin==s&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==s||to(e,s,Fo(i.done),t))?i.done[i.done.length-1]=t:ro(t,i.done),i.lastSelTime=+(new Date),i.lastSelOrigin=s,i.lastSelOp=n,r&&r.clearRedo!==!1&&Ys(i.undone)}function ro(e,t){var n=Fo(t);n&&n.ranges&&n.equals(e)||t.push(e)}function io(e,t,n,r){var i=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[s]=n.markedSpans),++s})}function so(e){if(!e)return null;for(var t=0,n;t<e.length;++t)e[t].marker.explicitlyCleared?n||(n=e.slice(0,t)):n&&n.push(e[t]);return n?n.length?n:null:e}function oo(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=0,i=[];r<t.text.length;++r)i.push(so(n[r]));return i}function uo(e,t,n){for(var r=0,i=[];r<e.length;++r){var s=e[r];if(s.ranges){i.push(n?gt.prototype.deepCopy.call(s):s);continue}var o=s.changes,u=[];i.push({changes:u});for(var a=0;a<o.length;++a){var f=o[a],l;u.push({from:f.from,to:f.to,text:f.text});if(t)for(var c in f)(l=c.match(/^spans_(\d+)$/))&&qo(t,Number(l[1]))>-1&&(Fo(u)[c]=f[c],delete f[c])}}return i}function ao(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function fo(e,t,n,r){for(var i=0;i<e.length;++i){var s=e[i],o=!0;if(s.ranges){s.copied||(s=e[i]=s.deepCopy(),s.copied=!0);for(var u=0;u<s.ranges.length;u++)ao(s.ranges[u].anchor,t,n,r),ao(s.ranges[u].head,t,n,r);continue}for(var u=0;u<s.changes.length;++u){var a=s.changes[u];if(n<a.from.line)a.from=ht(a.from.line+r,a.from.ch),a.to=ht(a.to.line+r,a.to.ch);else if(t<=a.to.line){o=!1;break}}o||(e.splice(0,i+1),i=0)}}function lo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;fo(e.done,n,r,i),fo(e.undone,n,r,i)}function po(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==0}function mo(e){return e.target||e.srcElement}function go(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),v&&e.ctrlKey&&t==1&&(t=3),t}function So(e,t){function s(e){return function(){e.apply(null,r)}}var n=e._handlers&&e._handlers[t];if(!n)return;var r=Array.prototype.slice.call(arguments,2),i;Nn?i=Nn.delayedCallbacks:Eo?i=Eo:(i=Eo=[],setTimeout(xo,0));for(var o=0;o<n.length;++o)i.push(s(n[o]))}function xo(){var e=Eo;Eo=null;for(var t=0;t<e.length;++t)e[t]()}function To(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),wo(e,n||t.type,e,t),po(t)||t.codemirrorIgnore}function No(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]);for(var r=0;r<t.length;++r)qo(n,t[r])==-1&&n.push(t[r])}function Co(e,t){var n=e._handlers&&e._handlers[t];return n&&n.length>0}function ko(e){e.prototype.on=function(e,t){yo(this,e,t)},e.prototype.off=function(e,t){bo(this,e,t)}}function Do(){this.id=null}function Ho(e,t,n){for(var r=0,i=0;;){var s=e.indexOf(" ",r);s==-1&&(s=e.length);var o=s-r;if(s==e.length||i+o>=t)return r+Math.min(o,t-i);i+=s-r,i+=n-i%n,r=s+1;if(i>=t)return r}}function jo(e){while(Bo.length<=e)Bo.push(Fo(Bo)+" ");return Bo[e]}function Fo(e){return e[e.length-1]}function qo(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}function Ro(e,t){var n=[];for(var r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Uo(e,t){var n;if(Object.create)n=Object.create(e);else{var r=function(){};r.prototype=e,n=new r}return t&&zo(t,n),n}function zo(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function Wo(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function $o(e,t){return t?t.source.indexOf("\\w")>-1&&Vo(e)?!0:t.test(e):Vo(e)}function Jo(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Qo(e){return e.charCodeAt(0)>=768&&Ko.test(e)}function Go(e,t,n,r){var i=document.createElement(e);n&&(i.className=n),r&&(i.style.cssText=r);if(typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var s=0;s<t.length;++s)i.appendChild(t[s]);return i}function Zo(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function eu(e,t){return Zo(e).appendChild(t)}function tu(e,t){if(e.contains)return e.contains(t);while(t=t.parentNode)if(t==e)return!0}function nu(){return document.activeElement}function ru(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function ou(e,t){var n=e.split(" ");for(var r=0;r<n.length;r++)n[r]&&!ru(n[r]).test(t)&&(t+=" "+n[r]);return t}function uu(e){if(!document.body.getElementsByClassName)return;var t=document.body.getElementsByClassName("CodeMirror");for(var n=0;n<t.length;n++){var r=t[n].CodeMirror;r&&e(r)}}function fu(){if(au)return;lu(),au=!0}function lu(){var e;yo(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,hu=null,uu(ir)},100))}),yo(window,"blur",function(){uu(Hr)})}function pu(e){if(hu!=null)return hu;var t=Go("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return eu(e,t),t.offsetWidth&&(hu=t.offsetHeight-t.clientHeight),hu||0}function vu(e){if(du==null){var t=Go("span","");eu(e,Go("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(du=t.offsetWidth<=1&&t.offsetHeight>2&&!(r&&i<8))}return du?Go("span",""):Go("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function gu(e){if(mu!=null)return mu;var t=eu(e,document.createTextNode("AخA")),n=Yo(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=Yo(t,1,2).getBoundingClientRect();return mu=r.right-n.right<3}function Su(e){if(Eu!=null)return Eu;var t=eu(e,Go("span","x")),n=t.getBoundingClientRect(),r=Yo(t,0,1).getBoundingClientRect();return Eu=Math.abs(n.left-r.left)>1}function Tu(e,t,n,r){if(!e)return r(t,n,"ltr");var i=!1;for(var s=0;s<e.length;++s){var o=e[s];if(o.from<n&&o.to>t||t==n&&o.to==t)r(Math.max(o.from,t),Math.min(o.to,n),o.level==1?"rtl":"ltr"),i=!0}i||r(t,n,"ltr")}function Nu(e){return e.level%2?e.to:e.from}function Cu(e){return e.level%2?e.from:e.to}function ku(e){var t=Ks(e);return t?Nu(t[0]):0}function Lu(e){var t=Ks(e);return t?Cu(Fo(t)):e.text.length}function Au(e,t){var n=Us(e.doc,t),r=ts(n);r!=n&&(t=Vs(r));var i=Ks(r),s=i?i[0].level%2?Lu(r):ku(r):0;return ht(t,s)}function Ou(e,t){var n,r=Us(e.doc,t);while(n=Zi(r))r=n.find(1,!0).line,t=null;var i=Ks(r),s=i?i[0].level%2?ku(r):Lu(r):r.text.length;return ht(t==null?Vs(r):t,s)}function Mu(e,t){var n=Au(e,t.line),r=Us(e.doc,n.line),i=Ks(r);if(!i||i[0].level==0){var s=Math.max(0,r.text.search(/\S/)),o=t.line==n.line&&t.ch<=s&&t.ch;return ht(n.line,o?0:s)}return n}function _u(e,t,n){var r=e[0].level;return t==r?!0:n==r?!1:t<n}function Pu(e,t){Du=null;for(var n=0,r;n<e.length;++n){var i=e[n];if(i.from<t&&i.to>t)return n;if(i.from==t||i.to==t){if(r!=null)return _u(e,i.level,e[r].level)?(i.from!=i.to&&(Du=r),n):(i.from!=i.to&&(Du=n),r);r=n}}return r}function Hu(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&Qo(e.text.charAt(t)));return t}function Bu(e,t,n,r){var i=Ks(e);if(!i)return ju(e,t,n,r);var s=Pu(i,t),o=i[s],u=Hu(e,t,o.level%2?-n:n,r);for(;;){if(u>o.from&&u<o.to)return u;if(u==o.from||u==o.to)return Pu(i,u)==s?u:(o=i[s+=n],n>0==o.level%2?o.to:o.from);o=i[s+=n];if(!o)return null;n>0==o.level%2?u=Hu(e,o.to,-1,r):u=Hu(e,o.from,1,r)}}function ju(e,t,n,r){var i=t+n;if(r)while(i>0&&Qo(e.text.charAt(i)))i+=n;return i<0||i>e.text.length?null:i}var e=/gecko\/\d/i.test(navigator.userAgent),t=/MSIE \d/.test(navigator.userAgent),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),r=t||n,i=r&&(t?document.documentMode||6:n[1]),s=/WebKit\//.test(navigator.userAgent),o=s&&/Qt\/\d+\.\d+/.test(navigator.userAgent),u=/Chrome\//.test(navigator.userAgent),a=/Opera\//.test(navigator.userAgent),f=/Apple Computer/.test(navigator.vendor),l=/KHTML\//.test(navigator.userAgent),c=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),h=/PhantomJS/.test(navigator.userAgent),p=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),d=p||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),v=p||/Mac/.test(navigator.platform),m=/win/i.test(navigator.platform),g=a&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(a=!1,s=!0);var y=v&&(o||a&&(g==null||g<12.11)),b=e||r&&i>=9,w=!1,E=!1,ht=S.Pos=function(e,t){if(!(this instanceof ht))return new ht(e,t);this.line=e,this.ch=t},pt=S.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch};gt.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 n=this.ranges[t],r=e.ranges[t];if(pt(n.anchor,r.anchor)!=0||pt(n.head,r.head)!=0)return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new yt(dt(this.ranges[t].anchor),dt(this.ranges[t].head));return new gt(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 n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(pt(t,r.from())>=0&&pt(e,r.to())<=0)return n}return-1}},yt.prototype={from:function(){return mt(this.anchor,this.head)},to:function(){return vt(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var on={left:0,right:0,top:0,bottom:0},Sn,Nn=null,Cn=0,Gn=null,ar,fr,vr=0,wr=0,Er=null;r?Er=-0.53:e?Er=15:u?Er=-0.7:f&&(Er=-1/3);var Nr=new Do,Ar=null,Fr=S.changeEnd=function(e){return e.text?ht(e.from.line+e.text.length-1,Fo(e.text).length+(e.text.length==1?e.from.ch:0)):e.to};S.prototype={constructor:S,focus:function(){window.focus(),er(this),Qn(this)},setOption:function(e,t){var n=this.options,r=n[e];if(n[e]==t&&e!="mode")return;n[e]=t,li.hasOwnProperty(e)&&jn(this,li[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"](Ci(e))},removeKeyMap:function(e){var t=this.state.keyMaps;for(var n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:Fn(function(e,t){var n=e.token?e:S.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:e,opaque:t&&t.opaque}),this.state.modeGen++,Un(this)}),removeOverlay:Fn(function(e){var t=this.state.overlays;for(var n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||typeof e=="string"&&r.name==e){t.splice(n,1),this.state.modeGen++,Un(this);return}}}),indentLine:Fn(function(e,t,n){typeof t!="string"&&typeof t!="number"&&(t==null?t=this.options.smartIndent?"smart":"prev":t=t?"add":"subtract"),Tt(this.doc,e)&&ii(this,e,t,n)}),indentSelection:Fn(function(e){var t=this.doc.sel.ranges,n=-1;for(var r=0;r<t.length;r++){var i=t[r];if(!i.empty()){var s=i.from(),o=i.to(),u=Math.max(n,s.line);n=Math.min(this.lastLine(),o.line-(o.ch?0:1))+1;for(var a=u;a<n;++a)ii(this,a,e);var f=this.doc.sel.ranges;s.ch==0&&t.length==f.length&&f[r].from().ch>0&&At(this.doc,r,new yt(s,f[r].to()),Oo)}else i.head.line>n&&(ii(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&ni(this))}}),getTokenAt:function(e,t){return gs(this,e,t)},getLineTokens:function(e,t){return gs(this,ht(e),t,!0)},getTokenTypeAt:function(e){e=St(this.doc,e);var t=ws(this,Us(this.doc,e.line)),n=0,r=(t.length-1)/2,i=e.ch,s;if(i==0)s=t[2];else for(;;){var o=n+r>>1;if((o?t[o*2-1]:0)>=i)r=o;else{if(!(t[o*2+1]<i)){s=t[o*2+2];break}n=o+1}}var u=s?s.indexOf("cm-overlay "):-1;return u<0?s:u==0?null:s.slice(0,u-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?S.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!gi.hasOwnProperty(t))return gi;var r=gi[t],i=this.getModeAt(e);if(typeof i[t]=="string")r[i[t]]&&n.push(r[i[t]]);else if(i[t])for(var s=0;s<i[t].length;s++){var o=r[i[t][s]];o&&n.push(o)}else i.helperType&&r[i.helperType]?n.push(r[i.helperType]):r[i.name]&&n.push(r[i.name]);for(var s=0;s<r._global.length;s++){var u=r._global[s];u.pred(i,this)&&qo(n,u.val)==-1&&n.push(u.val)}return n},getStateAfter:function(e,t){var n=this.doc;return e=Et(n,e==null?n.first+n.size-1:e),Jt(this,e+1,t)},cursorCoords:function(e,t){var n,r=this.doc.sel.primary();return e==null?n=r.head:typeof e=="object"?n=St(this.doc,e):n=e?r.from():r.to(),gn(this,n,t||"page")},charCoords:function(e,t){return mn(this,St(this.doc,e),t||"page")},coordsChar:function(e,t){return e=vn(this,e,t||"page"),wn(this,e.left,e.top)},lineAtHeight:function(e,t){return e=vn(this,{top:e,left:0},t||"page").top,$s(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var n=!1,r=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>r&&(e=r,n=!0);var i=Us(this.doc,e);return dn(this,i,{top:0,left:0},t||"page").top+(n?this.doc.height-Js(i):0)},defaultTextHeight:function(){return xn(this.display)},defaultCharWidth:function(){return Tn(this.display)},setGutterMarker:Fn(function(e,t,n){return si(this.doc,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&Jo(r)&&(e.gutterMarkers=null),!0})}),clearGutter:Fn(function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,zn(t,r,"gutter"),Jo(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),addLineWidget:Fn(function(e,t,n){return ls(this,e,t,n)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if(typeof e=="number"){if(!Tt(this.doc,e))return null;var t=e;e=Us(this.doc,e);if(!e)return null}else{var t=Vs(e);if(t==null)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,n,r,i){var s=this.display;e=gn(this,St(this.doc,e));var o=e.bottom,u=e.left;t.style.position="absolute",s.sizer.appendChild(t);if(r=="over")o=e.top;else if(r=="above"||r=="near"){var a=Math.max(s.wrapper.clientHeight,this.doc.height),f=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);(r=="above"||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?o=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(o=e.bottom),u+t.offsetWidth>f&&(u=f-t.offsetWidth)}t.style.top=o+"px",t.style.left=t.style.right="",i=="right"?(u=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):(i=="left"?u=0:i=="middle"&&(u=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),n&&Zr(this,u,o,u+t.offsetWidth,o+t.offsetHeight)},triggerOnKeyDown:Fn(Or),triggerOnKeyPress:Fn(Dr),triggerOnKeyUp:_r,execCommand:function(e){if(wi.hasOwnProperty(e))return wi[e](this)},findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var s=0,o=St(this.doc,e);s<t;++s){o=ui(this.doc,o,i,n,r);if(o.hitSide)break}return o},moveH:Fn(function(e,t){var n=this;n.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?ui(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()},_o)}),deleteH:Fn(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):oi(this,function(n){var i=ui(r,n.head,e,t,!1);return e<0?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(e,t,n,r){var i=1,s=r;t<0&&(i=-1,t=-t);for(var o=0,u=St(this.doc,e);o<t;++o){var a=gn(this,u,"div");s==null?s=a.left:a.left=s,u=ai(this,a,i,n);if(u.hitSide)break}return u},moveV:Fn(function(e,t){var n=this,r=this.doc,i=[],s=!n.display.shift&&!r.extend&&r.sel.somethingSelected();r.extendSelectionsBy(function(o){if(s)return e<0?o.from():o.to();var u=gn(n,o.head,"div");o.goalColumn!=null&&(u.left=o.goalColumn),i.push(u.left);var a=ai(n,u,e,t);return t=="page"&&o==r.sel.primary()&&ti(n,null,mn(n,a,"div").top-u.top),a},_o);if(i.length)for(var o=0;o<r.sel.ranges.length;o++)r.sel.ranges[o].goalColumn=i[o]}),findWordAt:function(e){var t=this.doc,n=Us(t,e.line).text,r=e.ch,i=e.ch;if(n){var s=this.getHelper(e,"wordChars");(e.xRel<0||i==n.length)&&r?--r:++i;var o=n.charAt(r),u=$o(o,s)?function(e){return $o(e,s)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!$o(e)};while(r>0&&u(n.charAt(r-1)))--r;while(i<n.length&&u(n.charAt(i)))++i}return new yt(ht(e.line,r),ht(e.line,i))},toggleOverwrite:function(e){if(e!=null&&e==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?su(this.display.cursorDiv,"CodeMirror-overwrite"):iu(this.display.cursorDiv,"CodeMirror-overwrite"),wo(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return nu()==this.display.input},scrollTo:Fn(function(e,t){(e!=null||t!=null)&&ri(this),e!=null&&(this.curOp.scrollLeft=e),t!=null&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller,t=Lo;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-t,width:e.scrollWidth-t,clientHeight:e.clientHeight-t,clientWidth:e.clientWidth-t}},scrollIntoView:Fn(function(e,t){e==null?(e={from:this.doc.sel.primary().head,to:null},t==null&&(t=this.options.cursorScrollMargin)):typeof e=="number"?e={from:ht(e,0),to:null}:e.from==null&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0;if(e.from.line!=null)ri(this),this.curOp.scrollToPos=e;else{var n=ei(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(n.scrollLeft,n.scrollTop)}}),setSize:Fn(function(e,t){function r(e){return typeof e=="number"||/^\d+$/.test(String(e))?e+"px":e}var n=this;e!=null&&(n.display.wrapper.style.width=r(e)),t!=null&&(n.display.wrapper.style.height=r(t)),n.options.lineWrapping&&ln(this);var i=n.display.viewFrom;n.doc.iter(i,n.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){zn(n,i,"widget");break}++i}),n.curOp.forceUpdate=!0,wo(n,"refresh",this)}),operation:function(e){return Bn(this,e)},refresh:Fn(function(){var e=this.display.cachedTextHeight;Un(this),this.curOp.forceUpdate=!0,cn(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),_(this),(e==null||Math.abs(e-xn(this.display))>.5)&&L(this),wo(this,"refresh",this)}),swapDoc:Fn(function(e){var t=this.doc;return t.cm=null,Rs(this,e),cn(this),Zn(this),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,So(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}},ko(S);var fi=S.defaults={},li=S.optionHandlers={},hi=S.Init={toString:function(){return"CodeMirror.Init"}};ci("value","",function(e,t){e.setValue(t)},!0),ci("mode",null,function(e,t){e.doc.modeOption=t,T(e)},!0),ci("indentUnit",2,T,!0),ci("indentWithTabs",!1),ci("smartIndent",!0),ci("tabSize",4,function(e){N(e),cn(e),Un(e)},!0),ci("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t){e.options.specialChars=new RegExp(t.source+(t.test(" ")?"":"| "),"g"),e.refresh()},!0),ci("specialCharPlaceholder",Cs,function(e){e.refresh()},!0),ci("electricChars",!0),ci("rtlMoveVisually",!m),ci("wholeLineUpdateBefore",!0),ci("theme","default",function(e){A(e),O(e)},!0),ci("keyMap","default",function(e,t,n){var r=Ci(t),i=n!=S.Init&&Ci(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),ci("extraKeys",null),ci("lineWrapping",!1,C,!0),ci("gutters",[],function(e){H(e.options),O(e)},!0),ci("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?z(e.display)+"px":"0",e.refresh()},!0),ci("coverGutterNextToScrollbar",!1,F,!0),ci("lineNumbers",!1,function(e){H(e.options),O(e)},!0),ci("firstLineNumber",1,O,!0),ci("lineNumberFormatter",function(e){return e},O,!0),ci("showCursorWhenSelecting",!1,Rt,!0),ci("resetSelectionOnContextMenu",!0),ci("readOnly",!1,function(e,t){t=="nocursor"?(Hr(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||Zn(e))}),ci("disableInput",!1,function(e,t){t||Zn(e)},!0),ci("dragDrop",!0),ci("cursorBlinkRate",530),ci("cursorScrollMargin",0),ci("cursorHeight",1,Rt,!0),ci("singleCursorHeightPerLine",!0,Rt,!0),ci("workTime",100),ci("workDelay",100),ci("flattenSpans",!0,N,!0),ci("addModeClass",!1,N,!0),ci("pollInterval",100),ci("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),ci("historyEventDelay",1250),ci("viewportMargin",10,function(e){e.refresh()},!0),ci("maxHighlightLength",1e4,N,!0),ci("moveInputWithCursor",!0,function(e,t){t||(e.display.inputDiv.style.top=e.display.inputDiv.style.left=0)}),ci("tabindex",null,function(e,t){e.display.input.tabIndex=t||""}),ci("autofocus",null);var pi=S.modes={},di=S.mimeModes={};S.defineMode=function(e,t){!S.defaults.mode&&e!="null"&&(S.defaults.mode=e),arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),pi[e]=t},S.defineMIME=function(e,t){di[e]=t},S.resolveMode=function(e){if(typeof e=="string"&&di.hasOwnProperty(e))e=di[e];else if(e&&typeof e.name=="string"&&di.hasOwnProperty(e.name)){var t=di[e.name];typeof t=="string"&&(t={name:t}),e=Uo(t,e),e.name=t.name}else if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return S.resolveMode("application/xml");return typeof e=="string"?{name:e}:e||{name:"null"}},S.getMode=function(e,t){var t=S.resolveMode(t),n=pi[t.name];if(!n)return S.getMode(e,"text/plain");var r=n(e,t);if(vi.hasOwnProperty(t.name)){var i=vi[t.name];for(var s in i){if(!i.hasOwnProperty(s))continue;r.hasOwnProperty(s)&&(r["_"+s]=r[s]),r[s]=i[s]}}r.name=t.name,t.helperType&&(r.helperType=t.helperType);if(t.modeProps)for(var s in t.modeProps)r[s]=t.modeProps[s];return r},S.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),S.defineMIME("text/plain","null");var vi=S.modeExtensions={};S.extendMode=function(e,t){var n=vi.hasOwnProperty(e)?vi[e]:vi[e]={};zo(t,n)},S.defineExtension=function(e,t){S.prototype[e]=t},S.defineDocExtension=function(e,t){js.prototype[e]=t},S.defineOption=ci;var mi=[];S.defineInitHook=function(e){mi.push(e)};var gi=S.helpers={};S.registerHelper=function(e,t,n){gi.hasOwnProperty(e)||(gi[e]=S[e]={_global:[]}),gi[e][t]=n},S.registerGlobalHelper=function(e,t,n,r){S.registerHelper(e,t,r),gi[e]._global.push({pred:n,val:r})};var yi=S.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n},bi=S.startState=function(e,t,n){return e.startState?e.startState(t,n):!0};S.innerMode=function(e,t){while(e.innerMode){var n=e.innerMode(t);if(!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}};var wi=S.commands={selectAll:function(e){e.setSelection(ht(e.firstLine(),0),ht(e.lastLine()),Oo)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Oo)},killLine:function(e){oi(e,function(t){if(t.empty()){var n=Us(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:ht(t.head.line+1,0)}:{from:t.head,to:ht(t.head.line,n)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){oi(e,function(t){return{from:ht(t.from().line,0),to:St(e.doc,ht(t.to().line+1,0))}})},delLineLeft:function(e){oi(e,function(e){return{from:ht(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){oi(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){oi(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},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(ht(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(ht(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return Au(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return Mu(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return Ou(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},_o)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},_o)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?Mu(e,t.head):r},_o)},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){var t=[],n=e.listSelections(),r=e.options.tabSize;for(var i=0;i<n.length;i++){var s=n[i].from(),o=Po(e.getLine(s.line),s.ch,r);t.push((new Array(r-o%r+1)).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){Bn(e,function(){var t=e.listSelections(),n=[];for(var r=0;r<t.length;r++){var i=t[r].head,s=Us(e.doc,i.line).text;if(s){i.ch==s.length&&(i=new ht(i.line,i.ch-1));if(i.ch>0)i=new ht(i.line,i.ch+1),e.replaceRange(s.charAt(i.ch-1)+s.charAt(i.ch-2),ht(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var o=Us(e.doc,i.line-1).text;o&&e.replaceRange(s.charAt(0)+"\n"+o.charAt(o.length-1),ht(i.line-1,o.length-1),ht(i.line,1),"+transpose")}}n.push(new yt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){Bn(e,function(){var t=e.listSelections().length;for(var n=0;n<t;n++){var r=e.listSelections()[n];e.replaceRange("\n",r.anchor,r.head,"+input"),e.indentLine(r.from().line+1,null,!0),ni(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},Ei=S.keyMap={};Ei.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"},Ei.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ei.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"},Ei.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ei["default"]=v?Ei.macDefault:Ei.pcDefault,S.normalizeKeyMap=function(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}var i=Ro(n.split(" "),Si);for(var s=0;s<i.length;s++){var o,u;s==i.length-1?(u=n,o=r):(u=i.slice(0,s+1).join(" "),o="...");var a=t[u];if(!a)t[u]=o;else if(a!=o)throw new Error("Inconsistent bindings for "+u)}delete e[n]}for(var f in t)e[f]=t[f];return e};var xi=S.lookupKey=function(e,t,n){t=Ci(t);var r=t.call?t.call(e):t[e];if(r===!1)return"nothing";if(r==="...")return"multi";if(r!=null&&n(r))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return xi(e,t.fallthrough,n);for(var i=0;i<t.fallthrough.length;i++){var s=xi(e,t.fallthrough[i],n);if(s)return s}}},Ti=S.isModifierKey=function(e){var t=typeof e=="string"?e:xu[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"},Ni=S.keyName=function(e,t){if(a&&e.keyCode==34&&e["char"])return!1;var n=xu[e.keyCode],r=n;return r==null||e.altGraphKey?!1:(e.altKey&&n!="Alt"&&(r="Alt-"+r),(y?e.metaKey:e.ctrlKey)&&n!="Ctrl"&&(r="Ctrl-"+r),(y?e.ctrlKey:e.metaKey)&&n!="Cmd"&&(r="Cmd-"+r),!t&&e.shiftKey&&n!="Shift"&&(r="Shift-"+r),r)};S.fromTextArea=function(e,t){function r(){e.value=a.getValue()}t||(t={}),t.value=e.value,!t.tabindex&&e.tabindex&&(t.tabindex=e.tabindex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder);if(t.autofocus==null){var n=nu();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}if(e.form){yo(e.form,"submit",r);if(!t.leaveSubmitMethodAlone){var i=e.form,s=i.submit;try{var o=i.submit=function(){r(),i.submit=s,i.submit(),i.submit=o}}catch(u){}}}e.style.display="none";var a=S(function(t){e.parentNode.insertBefore(t,e.nextSibling)},t);return a.save=r,a.getTextArea=function(){return e},a.toTextArea=function(){a.toTextArea=isNaN,r(),e.parentNode.removeChild(a.getWrapperElement()),e.style.display="",e.form&&(bo(e.form,"submit",r),typeof e.form.submit=="function"&&(e.form.submit=s))},a};var ki=S.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};ki.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var t=this.string.charAt(this.pos);if(typeof e=="string")var n=t==e;else var n=t&&(e.test?e.test(t):e(t));if(n)return++this.pos,t},eatWhile:function(e){var t=this.pos;while(this.eat(e));return this.pos>t},eatSpace:function(){var e=this.pos;while(/[\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);if(t>-1)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Po(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Po(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Po(this.string,null,this.tabSize)-(this.lineStart?Po(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,n){if(typeof e!="string"){var s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}var r=function(e){return n?e.toLowerCase():e},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!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 Li=S.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e};ko(Li),Li.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;t&&kn(e);if(Co(this,"clear")){var n=this.find();n&&So(this,"clear",n.from,n.to)}var r=null,i=null;for(var s=0;s<this.lines.length;++s){var o=this.lines[s],u=ji(o.markedSpans,this);e&&!this.collapsed?zn(e,Vs(o),"text"):e&&(u.to!=null&&(i=Vs(o)),u.from!=null&&(r=Vs(o))),o.markedSpans=Fi(o.markedSpans,u),u.from==null&&this.collapsed&&!ss(this.doc,o)&&e&&Xs(o,xn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var a=ts(this.lines[s]),f=D(a);f>e.display.maxLineLength&&(e.display.maxLine=a,e.display.maxLineLength=f,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Un(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Bt(e.doc)),e&&So(e,"markerCleared",e,this),t&&An(e),this.parent&&this.parent.clear()},Li.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);var n,r;for(var i=0;i<this.lines.length;++i){var s=this.lines[i],o=ji(s.markedSpans,this);if(o.from!=null){n=ht(t?s:Vs(s),o.from);if(e==-1)return n}if(o.to!=null){r=ht(t?s:Vs(s),o.to);if(e==1)return r}}return n&&{from:n,to:r}},Li.prototype.changed=function(){var e=this.find(-1,!0),t=this,n=this.doc.cm;if(!e||!n)return;Bn(n,function(){var r=e.line,i=Vs(e.line),s=nn(n,i);s&&(fn(s),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0;if(!ss(t.doc,r)&&t.height!=null){var o=t.height;t.height=null;var u=fs(t)-o;u&&Xs(r,r.height+u)}})},Li.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||qo(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Li.prototype.detachLine=function(e){this.lines.splice(qo(this.lines,e),1);if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var Ai=0,Mi=S.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};ko(Mi),Mi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();So(this,"clear")},Mi.prototype.find=function(e,t){return this.primary.find(e,t)};var us=S.LineWidget=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.cm=e,this.node=t};ko(us),us.prototype.clear=function(){var e=this.cm,t=this.line.widgets,n=this.line,r=Vs(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var s=fs(this);Bn(e,function(){as(e,n,-s),zn(e,r,"widget"),Xs(n,Math.max(0,n.height-s))})},us.prototype.changed=function(){var e=this.height,t=this.cm,n=this.line;this.height=null;var r=fs(this)-e;if(!r)return;Bn(t,function(){t.curOp.forceUpdate=!0,as(t,n,r),Xs(n,n.height+r)})};var cs=S.Line=function(e,t,n){this.text=e,$i(this,t),this.height=n?n(this):1};ko(cs),cs.prototype.lineNo=function(){return Vs(this)};var Ss={},xs={};Ps.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,ps(i),So(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},Hs.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var s=Math.min(t,i-e),o=r.height;r.removeInner(e,s),this.height-=o-r.height,i==s&&(this.children.splice(n--,1),r.parent=null);if((t-=s)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ps))){var u=[];this.collapse(u),this.children=[new Ps(u)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],s=i.chunkSize();if(e<=s){i.insertInner(e,t,n);if(i.lines&&i.lines.length>50){while(i.lines.length>50){var o=i.lines.splice(i.lines.length-25,25),u=new Ps(o);i.height-=u.height,this.children.splice(r+1,0,u),u.parent=this}this.maybeSpill()}break}e-=s}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Hs(t);if(!e.parent){var r=new Hs(e.children);r.parent=e,e.children=[r,n],e=r}else{e.size-=n.size,e.height-=n.height;var i=qo(e.parent.children,e);e.parent.children.splice(i+1,0,n)}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],s=i.chunkSize();if(e<s){var o=Math.min(t,s-e);if(i.iterN(e,o,n))return!0;if((t-=o)==0)break;e=0}else e-=s}}};var Bs=0,js=S.Doc=function(e,t,n){if(!(this instanceof js))return new js(e,t,n);n==null&&(n=0),Hs.call(this,[new Ps([new cs("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=n;var r=ht(n,0);this.sel=wt(r),this.history=new Qs(null),this.id=++Bs,this.modeOption=t,typeof e=="string"&&(e=yu(e)),Ds(this,{from:r,to:r,text:e}),Dt(this,wt(r),Oo)};js.prototype=Uo(Hs.prototype,{constructor:js,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){var n=0;for(var r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Ws(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:In(function(e){var t=ht(this.first,0),n=this.first+this.size-1;Wr(this,{from:t,to:ht(n,Us(this,n).text.length),text:yu(e),origin:"setValue"},!0),Dt(this,wt(t))}),replaceRange:function(e,t,n,r){t=St(this,t),n=n?St(this,n):t,Qr(this,e,t,n,r)},getRange:function(e,t,n){var r=zs(this,St(this,e),St(this,t));return n===!1?r:r.join(n||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Tt(this,e))return Us(this,e)},getLineNumber:function(e){return Vs(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Us(this,e)),ts(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return St(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:In(function(e,t,n){Ot(this,St(this,typeof e=="number"?ht(e,t||0):e),null,n)}),setSelection:In(function(e,t,n){Ot(this,St(this,e),St(this,t||e),n)}),extendSelection:In(function(e,t,n){kt(this,St(this,e),t&&St(this,t),n)}),extendSelections:In(function(e,t){Lt(this,Nt(this,e,t))}),extendSelectionsBy:In(function(e,t){Lt(this,Ro(this.sel.ranges,e),t)}),setSelections:In(function(e,t,n){if(!e.length)return;for(var r=0,i=[];r<e.length;r++)i[r]=new yt(St(this,e[r].anchor),St(this,e[r].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Dt(this,bt(i,t),n)}),addSelection:In(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new yt(St(this,e),St(this,t||e))),Dt(this,bt(r,r.length-1),n)}),getSelection:function(e){var t=this.sel.ranges,n;for(var r=0;r<t.length;r++){var i=zs(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||"\n")},getSelections:function(e){var t=[],n=this.sel.ranges;for(var r=0;r<n.length;r++){var i=zs(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||"\n")),t[r]=i}return t},replaceSelection:function(e,t,n){var r=[];for(var i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:In(function(e,t,n){var r=[],i=this.sel;for(var s=0;s<i.ranges.length;s++){var o=i.ranges[s];r[s]={from:o.from(),to:o.to(),text:yu(e[s]),origin:n}}var u=t&&t!="end"&&Ur(this,r,t);for(var s=r.length-1;s>=0;s--)Wr(this,r[s]);u?_t(this,u):this.cm&&ni(this.cm)}),undo:In(function(){Vr(this,"undo")}),redo:In(function(){Vr(this,"redo")}),undoSelection:In(function(){Vr(this,"undo",!0)}),redoSelection:In(function(){Vr(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){var e=this.history,t=0,n=0;for(var r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var r=0;r<e.undone.length;r++)e.undone[r].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){this.history=new Qs(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:uo(this.history.done),undone:uo(this.history.undone)}},setHistory:function(e){var t=this.history=new Qs(this.history.maxGeneration);t.done=uo(e.done.slice(0),null,!0),t.undone=uo(e.undone.slice(0),null,!0)},addLineClass:In(function(e,t,n){return si(this,e,t=="gutter"?"gutter":"class",function(e){var r=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!e[r])e[r]=n;else{if(ru(n).test(e[r]))return!1;e[r]+=" "+n}return!0})}),removeLineClass:In(function(e,t,n){return si(this,e,"class",function(e){var r=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",i=e[r];if(!i)return!1;if(n==null)e[r]=null;else{var s=i.match(ru(n));if(!s)return!1;var o=s.index+s[0].length;e[r]=i.slice(0,s.index)+(!s.index||o==i.length?"":" ")+i.slice(o)||null}return!0})}),markText:function(e,t,n){return Oi(this,St(this,e),St(this,t),n,"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared};return e=St(this,e),Oi(this,e,e,n,"bookmark")},findMarksAt:function(e){e=St(this,e);var t=[],n=Us(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=St(this,e),t=St(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(s){var o=s.markedSpans;if(o)for(var u=0;u<o.length;u++){var a=o[u];!(i==e.line&&e.ch>a.to||a.from==null&&i!=e.line||i==t.line&&a.from>t.ch)&&(!n||n(a.marker))&&r.push(a.marker.parent||a.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first;return this.iter(function(r){var i=r.text.length+1;if(i>e)return t=e,!0;e-=i,++n}),St(this,ht(n,t))},indexFromPos:function(e){e=St(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 js(Ws(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,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new js(Ws(this,t,n),e.mode||this.modeOption,t);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Pi(r,Di(this)),r},unlinkDoc:function(e){e instanceof S&&(e=e.doc);if(this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Hi(Di(this));break}if(e.history==this.history){var r=[e.id];qs(e,function(e){r.push(e.id)},!0),e.history=new Qs(null),e.history.done=uo(this.history.done,r),e.history.undone=uo(this.history.undone,r)}},iterLinkedDocs:function(e){qs(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),js.prototype.eachLine=js.prototype.iter;var Fs="iter insert remove copy getEditor".split(" ");for(var Is in js.prototype)js.prototype.hasOwnProperty(Is)&&qo(Fs,Is)<0&&(S.prototype[Is]=function(e){return function(){return e.apply(this.doc,arguments)}}(js.prototype[Is]));ko(js);var co=S.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},ho=S.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},vo=S.e_stop=function(e){co(e),ho(e)},yo=S.on=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={}),i=r[t]||(r[t]=[]);i.push(n)}},bo=S.off=function(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers&&e._handlers[t];if(!r)return;for(var i=0;i<r.length;++i)if(r[i]==n){r.splice(i,1);break}}},wo=S.signal=function(e,t){var n=e._handlers&&e._handlers[t];if(!n)return;var r=Array.prototype.slice.call(arguments,2);for(var i=0;i<n.length;++i)n[i].apply(null,r)},Eo=null,Lo=30,Ao=S.Pass={toString:function(){return"CodeMirror.Pass"}},Oo={scroll:!1},Mo={origin:"*mouse"},_o={origin:"+move"};Do.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Po=S.countColumn=function(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var s=r||0,o=i||0;;){var u=e.indexOf(" ",s);if(u<0||u>=t)return o+(t-s);o+=u-s,o+=n-o%n,s=u+1}},Bo=[""],Io=function(e){e.select()};p?Io=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:r&&(Io=function(e){try{e.select()}catch(t){}}),[].indexOf&&(qo=function(e,t){return e.indexOf(t)}),[].map&&(Ro=function(e,t){return e.map(t)});var Xo=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Vo=S.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Xo.test(e))},Ko=/[\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]/,Yo;document.createRange?Yo=function(e,t,n){var r=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}:Yo=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r},r&&i<11&&(nu=function(){try{return document.activeElement}catch(e){return document.body}});var iu=S.rmClass=function(e,t){var n=e.className,r=ru(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}},su=S.addClass=function(e,t){var n=e.className;ru(t).test(n)||(e.className+=(n?" ":"")+t)},au=!1,cu=function(){if(r&&i<9)return!1;var e=Go("div");return"draggable"in e||"dragDrop"in e}(),hu,du,mu,yu=S.splitLines="\n\nb".split(/\n/).length!=3?function(e){var t=0,n=[],r=e.length;while(t<=r){var i=e.indexOf("\n",t);i==-1&&(i=e.length);var s=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),o=s.indexOf("\r");o!=-1?(n.push(s.slice(0,o)),t+=o+1):(n.push(s),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},bu=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},wu=function(){var e=Go("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Eu=null,xu={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"};S.keyNames=xu,function(){for(var e=0;e<10;e++)xu[e+48]=xu[e+96]=String(e);for(var e=65;e<=90;e++)xu[e]=String.fromCharCode(e);for(var e=1;e<=12;e++)xu[e+111]=xu[e+63235]="F"+e}();var Du,Fu=function(){function n(n){return n<=247?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1773?t.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":n==8204?"b":"L"}function f(e,t,n){this.level=e,this.from=t,this.to=n}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,s=/[LRr]/,o=/[Lb1n]/,u=/[1n]/,a="L";return function(e){if(!r.test(e))return!1;var t=e.length,l=[];for(var c=0,h;c<t;++c)l.push(h=n(e.charCodeAt(c)));for(var c=0,p=a;c<t;++c){var h=l[c];h=="m"?l[c]=p:p=h}for(var c=0,d=a;c<t;++c){var h=l[c];h=="1"&&d=="r"?l[c]="n":s.test(h)&&(d=h,h=="r"&&(l[c]="R"))}for(var c=1,p=l[0];c<t-1;++c){var h=l[c];h=="+"&&p=="1"&&l[c+1]=="1"?l[c]="1":h==","&&p==l[c+1]&&(p=="1"||p=="n")&&(l[c]=p),p=h}for(var c=0;c<t;++c){var h=l[c];if(h==",")l[c]="N";else if(h=="%"){for(var v=c+1;v<t&&l[v]=="%";++v);var m=c&&l[c-1]=="!"||v<t&&l[v]=="1"?"1":"N";for(var g=c;g<v;++g)l[g]=m;c=v-1}}for(var c=0,d=a;c<t;++c){var h=l[c];d=="L"&&h=="1"?l[c]="L":s.test(h)&&(d=h)}for(var c=0;c<t;++c)if(i.test(l[c])){for(var v=c+1;v<t&&i.test(l[v]);++v);var y=(c?l[c-1]:a)=="L",b=(v<t?l[v]:a)=="L",m=y||b?"L":"R";for(var g=c;g<v;++g)l[g]=m;c=v-1}var w=[],E;for(var c=0;c<t;)if(o.test(l[c])){var S=c;for(++c;c<t&&o.test(l[c]);++c);w.push(new f(0,S,c))}else{var x=c,T=w.length;for(++c;c<t&&l[c]!="L";++c);for(var g=x;g<c;)if(u.test(l[g])){x<g&&w.splice(T,0,new f(1,x,g));var N=g;for(++g;g<c&&u.test(l[g]);++g);w.splice(T,0,new f(2,N,g)),x=g}else++g;x<c&&w.splice(T,0,new f(1,x,c))}return w[0].level==1&&(E=e.match(/^\s+/))&&(w[0].from=E[0].length,w.unshift(new f(0,0,E[0].length))),Fo(w).level==1&&(E=e.match(/\s+$/))&&(Fo(w).to-=E[0].length,w.push(new f(0,t-E[0].length,t))),w[0].level!=Fo(w).level&&w.push(new f(w[0].level,t,t)),w}}();return S.version="4.8.0",S}),define("CMLint",["react","lodash","jquery","./libs/codemirror-4.8/lib/codemirror"],function(e,t,n,r){"use strict";function i(e){var t=e.severity;t||(t="error");var n=document.createElement("div");return n.className="CodeMirror-lint-message-"+t,n.appendChild(document.createTextNode(e.message)),n}function o(e,t){var n=document.createDocumentFragment(),r={severity:"error",message:t.message};n.appendChild(i(r)),e.setGutterMarker(Math.max(t.line,0),s,a(n,"error",!1,"state.options.tooltips"))}function u(e){e.clearGutter(s)}function a(e,t,n,i){var s=document.createElement("div"),o=s;return s.className="CodeMirror-lint-marker-"+t,n&&(o=s.appendChild(document.createElement("div")),o.className="CodeMirror-lint-marker-multiple"),i!==!1&&r.on(o,"mouseover",function(t){h(t,e,o)}),s}function f(e,t){function i(e){if(!n.parentNode)return r.off(document,"mousemove",i);n.style.top=Math.max(0,e.clientY-n.offsetHeight-5)+"px",n.style.left=e.clientX+5+"px"}var n=document.createElement("div");return n.className="CodeMirror-lint-tooltip",n.appendChild(t.cloneNode(!0)),document.body.appendChild(n),r.on(document,"mousemove",i),i(e),n.style.opacity!==null&&(n.style.opacity=1),n}function l(e){e.parentNode&&e.parentNode.removeChild(e)}function c(e){if(!e.parentNode)return;e.style.opacity===null&&l(e),e.style.opacity=0,setTimeout(function(){l(e)},600)}function h(e,t,n){function s(){r.off(n,"mouseout",s),i&&(c(i),i=null)}var i=f(e,t),o=setInterval(function(){if(i)for(var e=n;;e=e.parentNode){if(e===document.body)return undefined;if(!e){s();break}}if(!i)return clearInterval(o)},400);r.on(n,"mouseout",s)}var s="rt-annotations";return{GUTTER_ID:s,annotate:o,clearMarks:u}}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("libs/codemirror-4.8/mode/javascript/javascript",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("javascript",function(t,n){function h(e){var t=!1,n,r=!1;while((n=e.next())!=null){if(!t){if(n=="/"&&!r)return;n=="["?r=!0:r&&n=="]"&&(r=!1)}t=!t&&n=="\\"}}function v(e,t,n){return p=e,d=n,t}function m(e,t){var n=e.next();if(n=='"'||n=="'")return t.tokenize=g(n),t.tokenize(e,t);if(n=="."&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return v("number","number");if(n=="."&&e.match(".."))return v("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return v(n);if(n=="="&&e.eat(">"))return v("=>","operator");if(n=="0"&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),v("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),v("number","number");if(n=="/")return e.eat("*")?(t.tokenize=y,y(e,t)):e.eat("/")?(e.skipToEnd(),v("comment","comment")):t.lastType=="operator"||t.lastType=="keyword c"||t.lastType=="sof"||/^[\[{}\(,;:]$/.test(t.lastType)?(h(e),e.eatWhile(/[gimy]/),v("regexp","string-2")):(e.eatWhile(l),v("operator","operator",e.current()));if(n=="`")return t.tokenize=b,b(e,t);if(n=="#")return e.skipToEnd(),v("error","error");if(l.test(n))return e.eatWhile(l),v("operator","operator",e.current());if(a.test(n)){e.eatWhile(a);var r=e.current(),i=f.propertyIsEnumerable(r)&&f[r];return i&&t.lastType!="."?v(i.type,i.style,r):v("variable","variable",r)}}function g(e){return function(t,n){var r=!1,i;if(s&&t.peek()=="@"&&t.match(c))return n.tokenize=m,v("jsonld-keyword","meta");while((i=t.next())!=null){if(i==e&&!r)break;r=!r&&i=="\\"}return r||(n.tokenize=m),v("string","string")}}function y(e,t){var n=!1,r;while(r=e.next()){if(r=="/"&&n){t.tokenize=m;break}n=r=="*"}return v("comment","comment")}function b(e,t){var n=!1,r;while((r=e.next())!=null){if(!n&&(r=="`"||r=="$"&&e.eat("{"))){t.tokenize=m;break}n=!n&&r=="\\"}return v("quasi","string-2",e.current())}function E(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(n<0)return;var r=0,i=!1;for(var s=n-1;s>=0;--s){var o=e.string.charAt(s),u=w.indexOf(o);if(u>=0&&u<3){if(!r){++s;break}if(--r==0)break}else if(u>=3&&u<6)++r;else if(a.test(o))i=!0;else if(i&&!r){++s;break}}i&&!r&&(t.fatArrowAt=s)}function x(e,t,n,r,i,s){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=s,r!=null&&(this.align=r)}function T(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(var n=r.vars;n;n=n.next)if(n.name==t)return!0}function N(e,t,n,r,i){var s=e.cc;C.state=e,C.stream=i,C.marked=null,C.cc=s,C.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);for(;;){var u=s.length?s.pop():o?j:B;if(u(n,r)){while(s.length&&s[s.length-1].lex)s.pop()();return C.marked?C.marked:n=="variable"&&T(e,r)?"variable-2":t}}}function k(){for(var e=arguments.length-1;e>=0;e--)C.cc.push(arguments[e])}function L(){return k.apply(null,arguments),!0}function A(e){function t(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var r=C.state;if(r.context){C.marked="def";if(t(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return;n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function M(){C.state.context={prev:C.state.context,vars:C.state.localVars},C.state.localVars=O}function _(){C.state.localVars=C.state.context.vars,C.state.context=C.state.context.prev}function D(e,t){var n=function(){var n=C.state,r=n.indented;if(n.lexical.type=="stat")r=n.lexical.indented;else for(var i=n.lexical;i&&i.type==")"&&i.align;i=i.prev)r=i.indented;n.lexical=new x(r,C.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function P(){var e=C.state;e.lexical.prev&&(e.lexical.type==")"&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function H(e){function t(n){return n==e?L():e==";"?k():L(t)}return t}function B(e,t){return e=="var"?L(D("vardef",t.length),it,H(";"),P):e=="keyword a"?L(D("form"),j,B,P):e=="keyword b"?L(D("form"),B,P):e=="{"?L(D("}"),tt,P):e==";"?L():e=="if"?(C.state.lexical.info=="else"&&C.state.cc[C.state.cc.length-1]==P&&C.state.cc.pop()(),L(D("form"),j,B,P,ft)):e=="function"?L(vt):e=="for"?L(D("form"),lt,B,P):e=="variable"?L(D("stat"),J):e=="switch"?L(D("form"),j,D("}","switch"),H("{"),tt,P,P):e=="case"?L(j,H(":")):e=="default"?L(H(":")):e=="catch"?L(D("form"),M,H("("),mt,H(")"),B,P,_):e=="module"?L(D("form"),M,Et,_,P):e=="class"?L(D("form"),gt,P):e=="export"?L(D("form"),St,P):e=="import"?L(D("form"),xt,P):k(D("stat"),j,H(";"),P)}function j(e){return I(e,!1)}function F(e){return I(e,!0)}function I(e,t){if(C.state.fatArrowAt==C.stream.start){var n=t?$:V;if(e=="(")return L(M,D(")"),Z(st,")"),P,H("=>"),n,_);if(e=="variable")return k(M,st,H("=>"),n,_)}var r=t?z:U;return S.hasOwnProperty(e)?L(r):e=="function"?L(vt,r):e=="keyword c"?L(t?R:q):e=="("?L(D(")"),q,Lt,H(")"),P,r):e=="operator"||e=="spread"?L(t?F:j):e=="["?L(D("]"),Ct,P,r):e=="{"?et(Q,"}",null,r):e=="quasi"?k(W,r):L()}function q(e){return e.match(/[;\}\)\],]/)?k():k(j)}function R(e){return e.match(/[;\}\)\],]/)?k():k(F)}function U(e,t){return e==","?L(j):z(e,t,!1)}function z(e,t,n){var r=n==0?U:z,i=n==0?j:F;if(e=="=>")return L(M,n?$:V,_);if(e=="operator")return/\+\+|--/.test(t)?L(r):t=="?"?L(j,H(":"),i):L(i);if(e=="quasi")return k(W,r);if(e==";")return;if(e=="(")return et(F,")","call",r);if(e==".")return L(K,r);if(e=="[")return L(D("]"),q,H("]"),P,r)}function W(e,t){return e!="quasi"?k():t.slice(t.length-2)!="${"?L(W):L(j,X)}function X(e){if(e=="}")return C.marked="string-2",C.state.tokenize=b,L(W)}function V(e){return E(C.stream,C.state),k(e=="{"?B:j)}function $(e){return E(C.stream,C.state),k(e=="{"?B:F)}function J(e){return e==":"?L(P,B):k(U,H(";"),P)}function K(e){if(e=="variable")return C.marked="property",L()}function Q(e,t){if(e=="variable"||C.style=="keyword")return C.marked="property",t=="get"||t=="set"?L(G):L(Y);if(e=="number"||e=="string")return C.marked=s?"property":C.style+" property",L(Y);if(e=="jsonld-keyword")return L(Y);if(e=="[")return L(j,H("]"),Y)}function G(e){return e!="variable"?k(Y):(C.marked="property",L(vt))}function Y(e){if(e==":")return L(F);if(e=="(")return k(vt)}function Z(e,t){function n(r){if(r==","){var i=C.state.lexical;return i.info=="call"&&(i.pos=(i.pos||0)+1),L(e,n)}return r==t?L():L(H(t))}return function(r){return r==t?L():k(e,n)}}function et(e,t,n){for(var r=3;r<arguments.length;r++)C.cc.push(arguments[r]);return L(D(t,n),Z(e,t),P)}function tt(e){return e=="}"?L():k(B,tt)}function nt(e){if(u&&e==":")return L(rt)}function rt(e){if(e=="variable")return C.marked="variable-3",L()}function it(){return k(st,nt,ut,at)}function st(e,t){if(e=="variable")return A(t),L();if(e=="[")return et(st,"]");if(e=="{")return et(ot,"}")}function ot(e,t){return e=="variable"&&!C.stream.match(/^\s*:/,!1)?(A(t),L(ut)):(e=="variable"&&(C.marked="property"),L(H(":"),st,ut))}function ut(e,t){if(t=="=")return L(F)}function at(e){if(e==",")return L(it)}function ft(e,t){if(e=="keyword b"&&t=="else")return L(D("form","else"),B,P)}function lt(e){if(e=="(")return L(D(")"),ct,H(")"),P)}function ct(e){return e=="var"?L(it,H(";"),pt):e==";"?L(pt):e=="variable"?L(ht):k(j,H(";"),pt)}function ht(e,t){return t=="in"||t=="of"?(C.marked="keyword",L(j)):L(U,pt)}function pt(e,t){return e==";"?L(dt):t=="in"||t=="of"?(C.marked="keyword",L(j)):k(j,H(";"),dt)}function dt(e){e!=")"&&L(j)}function vt(e,t){if(t=="*")return C.marked="keyword",L(vt);if(e=="variable")return A(t),L(vt);if(e=="(")return L(M,D(")"),Z(mt,")"),P,B,_)}function mt(e){return e=="spread"?L(mt):k(st,nt)}function gt(e,t){if(e=="variable")return A(t),L(yt)}function yt(e,t){if(t=="extends")return L(j,yt);if(e=="{")return L(D("}"),bt,P)}function bt(e,t){if(e=="variable"||C.style=="keyword")return C.marked="property",t=="get"||t=="set"?L(wt,vt,bt):L(vt,bt);if(t=="*")return C.marked="keyword",L(bt);if(e==";")return L(bt);if(e=="}")return L()}function wt(e){return e!="variable"?k():(C.marked="property",L())}function Et(e,t){if(e=="string")return L(B);if(e=="variable")return A(t),L(Nt)}function St(e,t){return t=="*"?(C.marked="keyword",L(Nt,H(";"))):t=="default"?(C.marked="keyword",L(j,H(";"))):k(B)}function xt(e){return e=="string"?L():k(Tt,Nt)}function Tt(e,t){return e=="{"?et(Tt,"}"):(e=="variable"&&A(t),L())}function Nt(e,t){if(t=="from")return C.marked="keyword",L(j)}function Ct(e){return e=="]"?L():k(F,kt)}function kt(e){return e=="for"?k(Lt,H("]")):e==","?L(Z(R,"]")):k(Z(F,"]"))}function Lt(e){if(e=="for")return L(lt,Lt);if(e=="if")return L(j,Lt)}var r=t.indentUnit,i=n.statementIndent,s=n.jsonld,o=n.json||s,u=n.typescript,a=n.wordCharacters||/[\w$\xa1-\uffff]/,f=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),r=e("keyword c"),i=e("operator"),s={type:"atom",style:"atom"},o={"if":e("if"),"while":t,"with":t,"else":n,"do":n,"try":n,"finally":n,"return":r,"break":r,"continue":r,"new":r,"delete":r,"throw":r,"debugger":r,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":s,"false":s,"null":s,"undefined":s,NaN:s,Infinity:s,"this":e("this"),module:e("module"),"class":e("class"),"super":e("atom"),yield:r,"export":e("export"),"import":e("import"),"extends":r};if(u){var a={type:"variable",style:"variable-3"},f={"interface":e("interface"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),string:a,number:a,bool:a,any:a};for(var l in f)o[l]=f[l]}return o}(),l=/[+\-*&%=<>!?|~^]/,c=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,p,d,w="([{}])",S={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},C={state:null,column:null,marked:null,cc:null},O={name:"this",next:{name:"arguments"}};return P.lex=!0,{startState:function(e){var t={tokenize:m,lastType:"sof",cc:[],lexical:new x((e||0)-r,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:0};return n.globalVars&&typeof n.globalVars=="object"&&(t.globalVars=n.globalVars),t},token:function(e,t){e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),E(e,t));if(t.tokenize!=y&&e.eatSpace())return null;var n=t.tokenize(e,t);return p=="comment"?n:(t.lastType=p!="operator"||d!="++"&&d!="--"?p:"incdec",N(t,n,p,d,e))},indent:function(t,s){if(t.tokenize==y)return e.Pass;if(t.tokenize!=m)return 0;var o=s&&s.charAt(0),u=t.lexical;if(!/^\s*else\b/.test(s))for(var a=t.cc.length-1;a>=0;--a){var f=t.cc[a];if(f==P)u=u.prev;else if(f!=ft)break}u.type=="stat"&&o=="}"&&(u=u.prev),i&&u.type==")"&&u.prev.type=="stat"&&(u=u.prev);var l=u.type,c=o==l;return l=="vardef"?u.indented+(t.lastType=="operator"||t.lastType==","?u.info+1:0):l=="form"&&o=="{"?u.indented:l=="form"?u.indented+r:l=="stat"?u.indented+(t.lastType=="operator"||t.lastType==","?i||r:0):u.info=="switch"&&!c&&n.doubleIndentSwitch!=0?u.indented+(/^(?:case|default)\b/.test(s)?r:2*r):u.align?u.column+(c?0:1):u.indented+(c?0:r)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:o?null:"/*",blockCommentEnd:o?null:"*/",lineComment:o?null:"//",fold:"brace",helperType:o?"json":"javascript",jsonldMode:s,jsonMode:o}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("libs/codemirror-4.8/addon/hint/xml-hint",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function n(n,r){var i=r&&r.schemaInfo,s=r&&r.quoteChar||'"';if(!i)return;var o=n.getCursor(),u=n.getTokenAt(o);if(/^<\/?$/.test(u.string)&&u.end==o.ch){var a=n.getTokenAt(t(o.line,o.ch+1));a.start==o.ch&&/\btag\b/.test(a.type)&&(u=a)}var f=e.innerMode(n.getMode(),u.state);if(f.mode.name!="xml")return;var l=[],c=!1,h,p=/\btag\b/.test(u.type)&&!/>$/.test(u.string),d=p&&/^\w/.test(u.string),v;if(d){var m=n.getLine(o.line).slice(Math.max(0,u.start-2),u.start),g=/<\/$/.test(m)?"close":/<$/.test(m)?"open":null;g&&(v=u.start-(g=="close"?2:1))}else p&&u.string=="<"?g="open":p&&u.string=="</"&&(g="close");if(!p&&!f.state.tagName||g){d&&(h=u.string),c=g;var y=f.state.context,b=y&&i[y.tagName],w=y?b&&b.children:i["!top"];if(w&&g!="close")for(var E=0;E<w.length;++E)(!h||w[E].lastIndexOf(h,0)==0)&&l.push("<"+w[E]);else if(g!="close")for(var S in i)i.hasOwnProperty(S)&&S!="!top"&&S!="!attrs"&&(!h||S.lastIndexOf(h,0)==0)&&l.push("<"+S);y&&(!h||g=="close"&&y.tagName.lastIndexOf(h,0)==0)&&l.push("</"+y.tagName+">")}else{var b=i[f.state.tagName],x=b&&b.attrs,T=i["!attrs"];if(!x&&!T)return;if(!x)x=T;else if(T){var N={};for(var C in T)T.hasOwnProperty(C)&&(N[C]=T[C]);for(var C in x)x.hasOwnProperty(C)&&(N[C]=x[C]);x=N}if(u.type=="string"||u.string=="="){var m=n.getRange(t(o.line,Math.max(0,o.ch-60)),t(o.line,u.type=="string"?u.start:u.end)),k=m.match(/([^\s\u00a0=<>\"\']+)=$/),L;if(!k||!x.hasOwnProperty(k[1])||!(L=x[k[1]]))return;typeof L=="function"&&(L=L.call(this,n));if(u.type=="string"){h=u.string;var A=0;/['"]/.test(u.string.charAt(0))&&(s=u.string.charAt(0),h=u.string.slice(1),A++);var O=u.string.length;/['"]/.test(u.string.charAt(O-1))&&(s=u.string.charAt(O-1),h=u.string.substr(A,O-2)),c=!0}for(var E=0;E<L.length;++E)(!h||L[E].lastIndexOf(h,0)==0)&&l.push(s+L[E]+s)}else{u.type=="attribute"&&(h=u.string,c=!0);for(var M in x)x.hasOwnProperty(M)&&(!h||M.lastIndexOf(h,0)==0)&&l.push(M)}}return{list:l,from:c?t(o.line,v==null?u.start:v):o,to:c?t(o.line,u.end):o}}var t=e.Pos;e.registerHelper("hint","xml",n)}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror","./xml-hint")):typeof define=="function"&&define.amd?define("libs/codemirror-4.8/addon/hint/html-hint",["../../lib/codemirror","./xml-hint"],e):e(CodeMirror)}(function(e){"use strict";function l(e){for(var t in f)f.hasOwnProperty(t)&&(e.attrs[t]=f[t])}function h(t,n){var r={schemaInfo:a};if(n)for(var i in n)r[i]=n[i];return e.hint.xml(t,r)}var t="ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" "),n=["_blank","_self","_top","_parent"],r=["ascii","utf-8","utf-16","latin1","latin1"],i=["get","post","put","delete"],s=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],o=["all","screen","print","embossed","braille","handheld","print","projection","screen","tty","tv","speech","3d-glasses","resolution [>][<][=] [X]","device-aspect-ratio: X/Y","orientation:portrait","orientation:landscape","device-height: [X]","device-width: [X]"],u={attrs:{}},a={a:{attrs:{href:null,ping:null,type:null,media:o,target:n,hreflang:t}},abbr:u,acronym:u,address:u,applet:u,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:o,hreflang:t,type:null,shape:["default","rect","circle","poly"]}},article:u,aside:u,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["","autoplay"],loop:["","loop"],controls:["","controls"]}},b:u,base:{attrs:{href:null,target:n}},basefont:u,bdi:u,bdo:u,big:u,blockquote:{attrs:{cite:null}},body:u,br:u,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["","autofocus"],disabled:["","autofocus"],formenctype:s,formmethod:i,formnovalidate:["","novalidate"],formtarget:n,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:u,center:u,cite:u,code:u,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["","disabled"],checked:["","checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["","disabled"],multiple:["","multiple"]}},datalist:{attrs:{data:null}},dd:u,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["","open"]}},dfn:u,dir:u,div:u,dl:u,dt:u,em:u,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["","disabled"],form:null,name:null}},figcaption:u,figure:u,font:u,footer:u,form:{attrs:{action:null,name:null,"accept-charset":r,autocomplete:["on","off"],enctype:s,method:i,novalidate:["","novalidate"],target:n}},frame:u,frameset:u,h1:u,h2:u,h3:u,h4:u,h5:u,h6:u,head:{attrs:{},children:["title","base","link","style","meta","script","noscript","command"]},header:u,hgroup:u,hr:u,html:{attrs:{manifest:null},children:["head","body"]},i:u,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["","seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["","autofocus"],checked:["","checked"],disabled:["","disabled"],formenctype:s,formmethod:i,formnovalidate:["","novalidate"],formtarget:n,multiple:["","multiple"],readonly:["","readonly"],required:["","required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:u,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["","autofocus"],disabled:["","disabled"],keytype:["RSA"]}},label:{attrs:{"for":null,form:null}},legend:u,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:t,media:o,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:u,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:r,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:u,noframes:u,noscript:u,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["","typemustmatch"]}},ol:{attrs:{reversed:["","reversed"],start:null,type:["1","a","A","i","I"]}},optgroup:{attrs:{disabled:["","disabled"],label:null}},option:{attrs:{disabled:["","disabled"],label:null,selected:["","selected"],value:null}},output:{attrs:{"for":null,form:null,name:null}},p:u,param:{attrs:{name:null,value:null}},pre:u,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:u,rt:u,ruby:u,s:u,samp:u,script:{attrs:{type:["text/javascript"],src:null,async:["","async"],defer:["","defer"],charset:r}},section:u,select:{attrs:{form:null,name:null,size:null,autofocus:["","autofocus"],disabled:["","disabled"],multiple:["","multiple"]}},small:u,source:{attrs:{src:null,type:null,media:null}},span:u,strike:u,strong:u,style:{attrs:{type:["text/css"],media:o,scoped:null}},sub:u,summary:u,sup:u,table:u,tbody:u,td:{attrs:{colspan:null,rowspan:null,headers:null}},textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["","autofocus"],disabled:["","disabled"],readonly:["","readonly"],required:["","required"],wrap:["soft","hard"]}},tfoot:u,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:u,time:{attrs:{datetime:null}},title:u,tr:u,track:{attrs:{src:null,label:null,"default":null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:t}},tt:u,u:u,ul:u,"var":u,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["","autoplay"],mediagroup:["movie"],muted:["","muted"],controls:["","controls"]}},wbr:u},f={accesskey:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"],"class":null,contenteditable:["true","false"],contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["en","es"],spellcheck:["true","false"],style:null,tabindex:["1","2","3","4","5","6","7","8","9"],title:null,translate:["yes","no"],onclick:null,rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"]};l(u);for(var c in a)a.hasOwnProperty(c)&&a[c]!=u&&l(a[c]);e.htmlSchema=a,e.registerHelper("hint","html",h)}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("libs/codemirror-4.8/addon/hint/show-hint",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function r(e,t){this.cm=e,this.options=this.buildOptions(t),this.widget=this.onClose=null}function i(e){return typeof e=="string"?e:e.text}function s(e,t){function s(e,r){var s;typeof r!="string"?s=function(e){return r(e,t)}:n.hasOwnProperty(r)?s=n[r]:s=r,i[e]=s}var n={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(-t.menuSize()+1,!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close},r=e.options.customKeys,i=r?{}:n;if(r)for(var o in r)r.hasOwnProperty(o)&&s(o,r[o]);var u=e.options.extraKeys;if(u)for(var o in u)u.hasOwnProperty(o)&&s(o,u[o]);return i}function o(e,t){while(t&&t!=e){if(t.nodeName.toUpperCase()==="LI"&&t.parentNode==e)return t;t=t.parentNode}}function u(r,u){this.completion=r,this.data=u;var a=this,f=r.cm,l=this.hints=document.createElement("ul");l.className="CodeMirror-hints",this.selectedHint=u.selectedHint||0;var c=u.list;for(var h=0;h<c.length;++h){var p=l.appendChild(document.createElement("li")),d=c[h],v=t+(h!=this.selectedHint?"":" "+n);d.className!=null&&(v=d.className+" "+v),p.className=v,d.render?d.render(p,u,d):p.appendChild(document.createTextNode(d.displayText||i(d))),p.hintId=h}var m=f.cursorCoords(r.options.alignWithWord?u.from:null),g=m.left,y=m.bottom,b=!0;l.style.left=g+"px",l.style.top=y+"px";var w=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),E=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(r.options.container||document.body).appendChild(l);var S=l.getBoundingClientRect(),x=S.bottom-E;if(x>0){var T=S.bottom-S.top,N=m.top-(m.bottom-S.top);if(N-T>0)l.style.top=(y=m.top-T)+"px",b=!1;else if(T>E){l.style.height=E-5+"px",l.style.top=(y=m.bottom-S.top)+"px";var C=f.getCursor();u.from.ch!=C.ch&&(m=f.cursorCoords(C),l.style.left=(g=m.left)+"px",S=l.getBoundingClientRect())}}var k=S.left-w;k>0&&(S.right-S.left>w&&(l.style.width=w-5+"px",k-=S.right-S.left-w),l.style.left=(g=m.left-k)+"px"),f.addKeyMap(this.keyMap=s(r,{moveFocus:function(e,t){a.changeActive(a.selectedHint+e,t)},setFocus:function(e){a.changeActive(e)},menuSize:function(){return a.screenAmount()},length:c.length,close:function(){r.close()},pick:function(){a.pick()},data:u}));if(r.options.closeOnUnfocus){var L;f.on("blur",this.onBlur=function(){L=setTimeout(function(){r.close()},100)}),f.on("focus",this.onFocus=function(){clearTimeout(L)})}var A=f.getScrollInfo();return f.on("scroll",this.onScroll=function(){var e=f.getScrollInfo(),t=f.getWrapperElement().getBoundingClientRect(),n=y+A.top-e.top,i=n-(window.pageYOffset||(document.documentElement||document.body).scrollTop);b||(i+=l.offsetHeight);if(i<=t.top||i>=t.bottom)return r.close();l.style.top=n+"px",l.style.left=g+A.left-e.left+"px"}),e.on(l,"dblclick",function(e){var t=o(l,e.target||e.srcElement);t&&t.hintId!=null&&(a.changeActive(t.hintId),a.pick())}),e.on(l,"click",function(e){var t=o(l,e.target||e.srcElement);t&&t.hintId!=null&&(a.changeActive(t.hintId),r.options.completeOnSingleClick&&a.pick())}),e.on(l,"mousedown",function(){setTimeout(function(){f.focus()},20)}),e.signal(u,"select",c[0],l.firstChild),!0}var t="CodeMirror-hint",n="CodeMirror-hint-active";e.showHint=function(e,t,n){if(!t)return e.showHint(n);n&&n.async&&(t.async=!0);var r={hint:t};if(n)for(var i in n)r[i]=n[i];return e.showHint(r)},e.defineExtension("showHint",function(t){if(this.listSelections().length>1||this.somethingSelected())return;this.state.completionActive&&this.state.completionActive.close();var n=this.state.completionActive=new r(this,t),i=n.options.hint;if(!i)return;e.signal(this,"startCompletion",this);if(!i.async)return n.showHints(i(this,n.options));i(this,function(e){n.showHints(e)},n.options)}),r.prototype={close:function(){if(!this.active())return;this.cm.state.completionActive=null,this.widget&&this.widget.close(),this.onClose&&this.onClose(),e.signal(this.cm,"endCompletion",this.cm)},active:function(){return this.cm.state.completionActive==this},pick:function(t,n){var r=t.list[n];r.hint?r.hint(this.cm,t,r):this.cm.replaceRange(i(r),r.from||t.from,r.to||t.to,"complete"),e.signal(t,"pick",r),this.close()},showHints:function(e){if(!e||!e.list.length||!this.active())return this.close();this.options.completeSingle&&e.list.length==1?this.pick(e,0):this.showWidget(e)},showWidget:function(t){function c(){if(i)return;i=!0,r.close(),r.cm.off("cursorActivity",v),t&&e.signal(t,"close")}function h(){if(i)return;e.signal(t,"update");var n=r.options.hint;n.async?n(r.cm,p,r.options):p(n(r.cm,r.options))}function p(e){t=e;if(i)return;if(!t||!t.list.length)return c();r.widget&&r.widget.close(),r.widget=new u(r,t)}function d(){n&&(l(n),n=0)}function v(){d();var e=r.cm.getCursor(),t=r.cm.getLine(e.line);e.line!=o.line||t.length-e.ch!=a-o.ch||e.ch<o.ch||r.cm.somethingSelected()||e.ch&&s.test(t.charAt(e.ch-1))?r.close():(n=f(h),r.widget&&r.widget.close())}this.widget=new u(this,t),e.signal(t,"shown");var n=0,r=this,i,s=this.options.closeCharacters,o=this.cm.getCursor(),a=this.cm.getLine(o.line).length,f=window.requestAnimationFrame||function(e){return setTimeout(e,1e3/60)},l=window.cancelAnimationFrame||clearTimeout;this.cm.on("cursorActivity",v),this.onClose=c},buildOptions:function(e){var t=this.cm.options.hintOptions,n={};for(var r in a)n[r]=a[r];if(t)for(var r in t)t[r]!==undefined&&(n[r]=t[r]);if(e)for(var r in e)e[r]!==undefined&&(n[r]=e[r]);return n}},u.prototype={close:function(){if(this.completion.widget!=this)return;this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var e=this.completion.cm;this.completion.options.closeOnUnfocus&&(e.off("blur",this.onBlur),e.off("focus",this.onFocus)),e.off("scroll",this.onScroll)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(t,r){t>=this.data.list.length?t=r?this.data.list.length-1:0:t<0&&(t=r?0:this.data.list.length-1);if(this.selectedHint==t)return;var i=this.hints.childNodes[this.selectedHint];i.className=i.className.replace(" "+n,""),i=this.hints.childNodes[this.selectedHint=t],i.className+=" "+n,i.offsetTop<this.hints.scrollTop?this.hints.scrollTop=i.offsetTop-3:i.offsetTop+i.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=i.offsetTop+i.offsetHeight-this.hints.clientHeight+3),e.signal(this.data,"select",this.data.list[this.selectedHint],i)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},e.registerHelper("hint","auto",function(t,n){var r=t.getHelpers(t.getCursor(),"hint"),i;if(r.length)for(var s=0;s<r.length;s++){var o=r[s](t,n);if(o&&o.list.length)return o}else if(i=t.getHelper(t.getCursor(),"hintWords")){if(i)return e.hint.fromList(t,{words:i})}else if(e.hint.anyword)return e.hint.anyword(t,n)}),e.registerHelper("hint","fromList",function(t,n){var r=t.getCursor(),i=t.getTokenAt(r),s=[];for(var o=0;o<n.words.length;o++){var u=n.words[o];u.slice(0,i.string.length)==i.string&&s.push(u)}if(s.length)return{list:s,from:e.Pos(r.line,i.start),to:e.Pos(r.line,i.end)}}),e.commands.autocomplete=e.showHint;var a={hint:e.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,extraKeys:null};e.defineOption("hintOptions",null)}),function(e){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("libs/codemirror-4.8/mode/xml/xml",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("xml",function(t,n){function l(e,t){function n(n){return t.tokenize=n,n(e,t)}var r=e.next();if(r=="<")return e.eat("!")?e.eat("[")?e.match("CDATA[")?n(p("atom","]]>")):null:e.match("--")?n(p("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(d(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=p("meta","?>"),"meta"):(a=e.eat("/")?"closeTag":"openTag",t.tokenize=c,"tag bracket");if(r=="&"){var i;return e.eat("#")?e.eat("x")?i=e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):i=e.eatWhile(/[\d]/)&&e.eat(";"):i=e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function c(e,t){var n=e.next();if(n==">"||n=="/"&&e.eat(">"))return t.tokenize=l,a=n==">"?"endTag":"selfcloseTag","tag bracket";if(n=="=")return a="equals",null;if(n=="<"){t.tokenize=l,t.state=y,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=h(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(e){var t=function(t,n){while(!t.eol())if(t.next()==e){n.tokenize=c;break}return"string"};return t.isInAttribute=!0,t}function p(e,t){return function(n,r){while(!n.eol()){if(n.match(t)){r.tokenize=l;break}n.next()}return e}}function d(e){return function(t,n){var r;while((r=t.next())!=null){if(r=="<")return n.tokenize=d(e+1),n.tokenize(t,n);if(r==">"){if(e==1){n.tokenize=l;break}return n.tokenize=d(e-1),n.tokenize(t,n)}}return"meta"}}function v(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n;if(o.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)this.noIndent=!0}function m(e){e.context&&(e.context=e.context.prev)}function g(e,t){var n;for(;;){if(!e.context)return;n=e.context.tagName;if(!o.contextGrabbers.hasOwnProperty(n)||!o.contextGrabbers[n].hasOwnProperty(t))return;m(e)}}function y(e,t,n){return e=="openTag"?(n.tagStart=t.column(),b):e=="closeTag"?w:y}function b(e,t,n){return e=="word"?(n.tagName=t.current(),f="tag",x):(f="error",b)}function w(e,t,n){if(e=="word"){var r=t.current();return n.context&&n.context.tagName!=r&&o.implicitlyClosed.hasOwnProperty(n.context.tagName)&&m(n),n.context&&n.context.tagName==r?(f="tag",E):(f="tag error",S)}return f="error",S}function E(e,t,n){return e!="endTag"?(f="error",E):(m(n),y)}function S(e,t,n){return f="error",E(e,t,n)}function x(e,t,n){if(e=="word")return f="attribute",T;if(e=="endTag"||e=="selfcloseTag"){var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,e=="selfcloseTag"||o.autoSelfClosers.hasOwnProperty(r)?g(n,r):(g(n,r),n.context=new v(n,r,i==n.indented)),y}return f="error",x}function T(e,t,n){return e=="equals"?N:(o.allowMissing||(f="error"),x(e,t,n))}function N(e,t,n){return e=="string"?C:e=="word"&&o.allowUnquoted?(f="string",x):(f="error",x(e,t,n))}function C(e,t,n){return e=="string"?C:x(e,t,n)}var r=t.indentUnit,i=n.multilineTagIndentFactor||1,s=n.multilineTagIndentPastTag;s==null&&(s=!0);var o=n.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,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},u=n.alignCDATA,a,f;return{startState:function(){return{tokenize:l,state:y,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){!t.tagName&&e.sol()&&(t.indented=e.indentation());if(e.eatSpace())return null;a=null;var n=t.tokenize(e,t);return(n||a)&&n!="comment"&&(f=null,t.state=t.state(a||n,e,t),f&&(n=f=="error"?n+" error":f)),n},indent:function(t,n,a){var f=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+r;if(f&&f.noIndent)return e.Pass;if(t.tokenize!=c&&t.tokenize!=l)return a?a.match(/^(\s*)/)[0].length:0;if(t.tagName)return s?t.tagStart+t.tagName.length+2:t.tagStart+r*i;if(u&&/<!\[CDATA\[/.test(n))return 0;var h=n&&/^<(\/)?([\w_:\.-]*)/.exec(n);if(h&&h[1])while(f){if(f.tagName==h[2]){f=f.prev;break}if(!o.implicitlyClosed.hasOwnProperty(f.tagName))break;f=f.prev}else if(h)while(f){var p=o.contextGrabbers[f.tagName];if(!p||!p.hasOwnProperty(h[2]))break;f=f.prev}while(f&&!f.startOfLine)f=f.prev;return f?f.indent+r:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:n.htmlMode?"html":"xml",helperType:n.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){typeof exports=="object"&&typeof module=="object"?e(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define("libs/codemirror-4.8/addon/runmode/runmode",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.runMode=function(t,n,r,i){var s=e.getMode(e.defaults,n),o=/MSIE \d/.test(navigator.userAgent),u=o&&(document.documentMode==null||document.documentMode<9);if(r.nodeType==1){var a=i&&i.tabSize||e.defaults.tabSize,f=r,l=0;f.innerHTML="",r=function(e,t){if(e=="\n"){f.appendChild(document.createTextNode(u?"\r":e)),l=0;return}var n="";for(var r=0;;){var i=e.indexOf(" ",r);if(i==-1){n+=e.slice(r),l+=e.length-r;break}l+=i-r,n+=e.slice(r,i);var s=a-l%a;l+=s;for(var o=0;o<s;++o)n+=" ";r=i+1}if(t){var c=f.appendChild(document.createElement("span"));c.className="cm-"+t.replace(/ +/g," cm-"),c.appendChild(document.createTextNode(n))}else f.appendChild(document.createTextNode(n))}}var c=e.splitLines(t),h=i&&i.state||e.startState(s);for(var p=0,d=c.length;p<d;++p){p&&r("\n");var v=new e.StringStream(c[p]);!v.string&&s.blankLine&&s.blankLine(h);while(!v.eol()){var m=s.token(v,h);r(v.current(),m,p,v.start,h),v.start=v.pos}}}}),define("CodeMirrorEditor",["react","lodash","jquery","./libs/codemirror-4.8/lib/codemirror","./CMLint","./libs/codemirror-4.8/mode/javascript/javascript","./libs/codemirror-4.8/addon/hint/html-hint","./libs/codemirror-4.8/addon/hint/show-hint","./libs/codemirror-4.8/addon/hint/xml-hint","./libs/codemirror-4.8/addon/hint/html-hint","./libs/codemirror-4.8/mode/xml/xml","./libs/codemirror-4.8/addon/runmode/runmode"],function(e,t,n,r,i){"use strict";function u(e,t){return(!t||t())&&setTimeout(function(){e.state.completionActive||e.showHint({completeSingle:!1})},100),r.Pass}function a(e){return u(e,function(){var t=e.getCursor();return e.getRange(r.Pos(t.line,t.ch-1),t)==="<"})}function f(e){return u(e,function(){var t=e.getTokenAt(e.getCursor());if(t.type!=="string"||!!/['"]/.test(t.string.charAt(t.string.length-1))&&t.string.length!==1){var n=r.innerMode(e.getMode(),t.state).state;return n.tagName}return!1})}var s={div:{attrs:{"rt-props":null,"rt-if":null,"rt-repeat":null,"rt-class":null,"rt-scope":null,valueLink:null,key:null,ref:null,dangerouslySetInnerHTML:null}}},o=r.htmlSchema;return Object.keys(r.htmlSchema).forEach(function(e){o[e].attrs=t.defaults(s.div.attrs,o[e].attrs)}),e.createClass({displayName:"CodeMirrorEditor",propTypes:{id:e.PropTypes.string,readOnly:e.PropTypes.bool,runMode:e.PropTypes.bool,mode:e.PropTypes.string,value:e.PropTypes.string,valueLink:e.PropTypes.string,onChange:e.PropTypes.func},getDefaultProps:function(){return{readOnly:!1,mode:"html"}},getInitialState:function(){return{editorId:t.uniqueId()}},render:function(){var n=t.omit(this.props,["ref","key","value","valueLink","onChange"]);return n.id=this.props.id||this.state.editorId,n.defaultValue=this.props.valueLink?this.props.valueLink():this.props.value,e.DOM.textarea(n)},componentWillUpdate:function(e){var t=e.valueLink?e.valueLink():e.value;this.editor&&this.editor.getValue()!==t&&this.editor.setValue(t||"")},componentDidMount:function(){var e=this.props.valueLink?this.props.valueLink():this.props.value,t={readOnly:this.props.readOnly,lineWrapping:!0,smartIndent:!0,matchBrackets:!0,value:e,lineNumbers:!0,mode:"javascript",gutters:["CodeMirror-linenumbers","rt-annotations"],theme:"solarized"};this.props.mode==="html"?(t.mode="text/html",t.extraKeys={"'<'":u,"'/'":a,"' '":f,"'='":f,"Ctrl-Space":"autocomplete"},t.hintOptions={schemaInfo:o}):t.mode="javascript",this.editor=r.fromTextArea(this.getDOMNode(),t),this.props.readOnly||this.editor.on("change",function(){this.props.valueLink?this.props.valueLink(this.editor.getValue()):this.props.onChange&&this.props.onChange({target:{value:this.editor.getValue()}})}.bind(this))},annotate:function(e){i.annotate(this.editor,e)},clearAnnotations:function(){i.clearMarks(this.editor)},componentWillUnmount:function(){this.editor.toTextArea()}})}),define("playground-fiddle.rt",["react/addons","lodash","./CodeMirrorEditor"],function(e,t,n){"use strict";function r(e){this.setState({templateHTML:e.target.value})}function i(e){this.setState({templateProps:e.target.value})}function s(e){e.preventDefault()}return function(){return e.createElement("div",{className:"playground"},e.createElement("div",{className:"fiddle-row"},e.createElement("div",{className:"code-area",id:"area-rt"},e.createElement(n,{ref:"editorRT",id:"editor-rt",className:"large-text-area",value:this.state.templateHTML,mode:"html",onChange:r.bind(this)})),e.createElement("div",{className:"code-area",id:"area-code"},e.createElement(n,{ref:"editorCode",id:"editor-code",className:"large-text-area",value:this.state.templateProps,mode:"javascript",onChange:i.bind(this)}))),e.createElement("div",{className:"fiddle-row"},e.createElement("div",{className:"code-area",id:"area-generated"},e.createElement(n,{id:"editor-generated",className:"large-text-area",ref:"editorGenerated",value:this.templateSource,mode:"javascript",readOnly:!0})),e.createElement("div",{className:"code-area",id:"area-result"},e.createElement("div",{id:"result-area",key:"result-area",className:"sample-view"},e.createElement("form",{className:"result-area-form",ref:"mount",onSubmit:s.bind(this)})))))}}),define("playground.rt",["react/addons","lodash","./CodeMirrorEditor"],function(e,t,n){"use strict";function r(e,t,n){n.preventDefault(),this.setState({currentTab:e[0]})}function i(n,i){return e.createElement("li",{role:"presentation",key:"tab"+i,className:t({active:this.state.currentTab===n[0]}).transform(function(e,t,n){t&&e.push(n)},[]).join(" "),onClick:r.bind(this,n,i)},e.createElement("a",{"aria-controls":n[1]},n[1]))}function s(e){this.setState({templateHTML:e.target.value})}function o(e){this.setState({templateProps:e.target.value})}function u(e){e.preventDefault()}return function(){return e.createElement("div",{className:"playground"},e.createElement("div",{id:this.props.id+"-myTab",className:"code-area "+this.getLayoutClass()},e.createElement.apply(this,["ul",{className:"nav nav-tabs",role:"tablist"},t.map(this.getTabs(),i.bind(this))]),e.createElement("div",{},this.state.currentTab==="templateHTML"?e.createElement("div",{key:"editorRT",className:"tab-pane active"},e.createElement(n,{ref:"editorRT",className:"large-text-area",style:{border:this.validHTML?"":"2px solid red"},value:this.state.templateHTML,mode:"html",onChange:s.bind(this)})):null,this.state.currentTab==="templateProps"?e.createElement("div",{key:"editorCode",className:"tab-pane active"},e.createElement(n,{ref:"editorCode",className:"large-text-area",style:{border:this.validProps?"":"2px solid red"},value:this.state.templateProps,mode:"javascript",onChange:o.bind(this)})):null,this.state.currentTab==="templateSource"?e.createElement("div",{key:"templateSource",className:"tab-pane active"},e.createElement(n,{className:"large-text-area",value:this.templateSource,mode:"javascript",readOnly:!0})):null)),e.createElement("div",{key:"result-area",className:"result-area "+this.getLayoutClass()},e.createElement("span",{className:"preview-title"}," "),e.createElement("form",{ref:"mount",className:"sample-view",onSubmit:u.bind(this)})),e.createElement("br",{style:{clear:"both"}}))}}),define("playground",["react","jquery","lodash","./playground-fiddle.rt","./playground.rt"],function(React,$,_,pgFiddleTemplate,playgroundTemplate){"use strict";function showMessage(e,t){e&&e.showMessage&&e.annotate({line:1,message:t})}function clearMessage(e){e&&e.clearAnnotations&&e.clearAnnotations()}function generateRenderFunc(e){return function(){var t=null;try{t=e.apply(this)}catch(n){t=React.DOM.div.apply(this,[{style:{color:"red"}},"Exception:"+n.message])}return React.DOM.div.apply(this,_.flatten([{key:"result"},t]))}}var templateHTML="<div></div>",templateProps="var template = React.createClass({\n render: templateRT\n});",Playground=React.createClass({displayName:"Playground",mixins:[React.addons.LinkedStateMixin],propTypes:{direction:React.PropTypes.oneOf(["horizontal","vertical"]),codeVisible:React.PropTypes.bool,fiddle:React.PropTypes.bool,templateHTML:React.PropTypes.string,templateProps:React.PropTypes.string,name:React.PropTypes.string},templateSource:"",validHTML:!0,validProps:!0,setTimeout:function(){clearTimeout(this.timeoutID),this.timeoutID=setTimeout.apply(null,arguments)},getDefaultProps:function(){return{direction:"horizontal",codeVisible:!0,fiddle:!1}},getLayoutClass:function(){return this.props.direction==="horizontal"&&"horizontal"||"vertical"},getTabs:function(){return this.props.codeVisible?[["templateHTML","Template"],["templateProps","Class"],["templateSource","Generated code"]]:[["templateHTML","Template"],["templateSource","Generated code"]]},updateSample:function(state){this.generateCode(state),this.validHTML=!0,this.sampleRender=generateRenderFunc(this.sampleFunc);var editor;try{this.validProps=!0,this.sample=eval("(function () {"+this.templateSource+"\n"+state.templateProps+"\n return React.createElement("+state.name+");})()"),clearMessage(this.refs.editorCode)}catch(e){this.validProps=!1,this.sample=null,editor=this.refs.editorCode,this.showError(e,editor)}},showError:function(e,t){var n=this.refs.mount.getDOMNode();this.setTimeout(function(){showMessage(t,e.message),React.render(React.createElement("div",{className:"playground-error"},e.toString()),n)},500)},showErrorAnnotation:function(e,t){var n=this.refs.mount.getDOMNode();this.setTimeout(function(){t.annotate(e),React.render(React.createElement("div",{className:"playground-error"},e.message),n)},500)},clear:function(){var e={templateHTML:templateHTML,templateProps:templateProps};this.setState(e)},generateCode:function(e){var t=e.templateHTML,n=this.refs.editorRT,r=window.reactTemplates.normalizeName(e.name)+"RT",i=null;try{i=window.reactTemplates.convertTemplateToReact(t.trim().replace(/\r/g,""),{modules:"none",name:r}),clearMessage(n)}catch(s){var o=s.name==="RTCodeError"?{line:s.line,message:s.message,index:s.index}:{line:1,message:s.message};this.showErrorAnnotation(o,n),console.log(s)}this.templateSource=i},getInitialState:function(){var e={templateHTML:this.props.templateHTML||templateHTML,templateProps:this.props.templateProps||templateProps,name:this.props.name||"template",currentTab:"templateHTML"};return e},componentDidMount:function(){this.props.fiddle&&(window.addEventListener("resize",this.calcSize),this.calcSize()),this.updateSample(this.state),this.renderSample()},renderSample:function(){var e=this.refs.mount.getDOMNode();this.sample&&React.render(this.sample,e)},componentDidUpdate:function(){this.renderSample()},componentWillUnmount:function(){window.removeEventListener("resize",this.calcSize)},calcSize:function(){var e=$(window).height()-$("#header").height(),t=e/2-10;$(".code-area").each(function(){$(this).height(t)}),this.refs.editorCode.editor.refresh(),this.refs.editorRT.editor.refresh(),this.refs.editorGenerated.editor.refresh()},componentWillUpdate:function(e,t){(t.templateHTML!==this.state.templateHTML||t.templateProps!==this.state.templateProps)&&this.updateSample(t)},render:function(){this.generateCode(this.state);var e=this.props.fiddle?pgFiddleTemplate:playgroundTemplate;return e.apply(this)}});return Playground}),define("CodeMirrorViewer",["react","lodash","jquery","./libs/codemirror-4.8/lib/codemirror","./libs/codemirror-4.8/mode/javascript/javascript","./libs/codemirror-4.8/mode/xml/xml","./libs/codemirror-4.8/addon/runmode/runmode"],function(e,t,n,r){"use strict";return e.createClass({displayName:"CodeMirrorViewer",propTypes:{id:e.PropTypes.string,mode:e.PropTypes.string,value:e.PropTypes.string,valueLink:e.PropTypes.string},getDefaultProps:function(){return{mode:"html"}},getInitialState:function(){return{editorId:t.uniqueId()}},render:function(){var n=t.omit(this.props,["ref","key","value","valueLink","onChange"]);n.id=this.props.id||this.state.editorId,n.className="cm-s-default";var r=this.props.valueLink?this.props.valueLink():this.props.value;return e.DOM.pre(n,r)},componentWillUpdate:function(e){var t=e.valueLink?e.valueLink():e.value;this.editor&&this.editor.getValue()!==t&&this.editor.setValue(t||"")},componentDidMount:function(){var e=this.props.valueLink?this.props.valueLink():this.props.value,t=this.props.mode;this.props.mode==="html"&&(t="text/html"),this.editor=r.runMode(e,t,this.getDOMNode())},componentWillUnmount:function(){this.editor.toTextArea()}})}),define("examples.rt",["react/addons","lodash","./playground","./CodeMirrorViewer"],function(e,t,n,r){"use strict";return function(){return e.createElement("div",{id:"examples"},e.createElement("div",{className:"example"},e.createElement("h3",{},"Hello world in React Templates"),e.createElement("p",{},'\n Simple "Hello world" HTML transformed into React JavaScript code.\n '),e.createElement(n,t.assign({},{id:"helloExample",direction:"horizontal"},this.state.samples.hello))),e.createElement("div",{className:"example"},e.createElement("h3",{},"rt-if"),e.createElement("p",{},"\n This shows the use of rt-if.\n "),e.createElement(n,t.assign({},{id:"ifExample",direction:"horizontal"},this.state.samples.rtIf))),e.createElement("div",{className:"example"},e.createElement("h3",{},"rt-repeat"),e.createElement("p",{},"\n This uses rt-repeat to show multiple items and rt-scope to create a reusable name for multiple calculations.\n "),e.createElement(n,t.assign({},{id:"repeatExample",direction:"horizontal"},this.state.samples.repeat))),e.createElement("div",{className:"example"},e.createElement("h3",{},"rt-props"),e.createElement("p",{},"\n rt-props is used to pass all the original properties set on this component (except the ones used for the component logic: onClick and eventId) to the element that will actually represent this component.\n "),e.createElement(n,t.assign({},{id:"propsExample",direction:"horizontal"},this.state.samples.props))),e.createElement("div",{className:"example"},e.createElement("h3",{},"Improved todo list"),e.createElement("p",{},"\n Every project needs a todo list example, so here is ours.\n "),e.createElement(n,t.assign({},{id:"todoExample",direction:"horizontal"},this.state.samples.todo))),e.createElement("div",{className:"example"},e.createElement("h3",{},"Weather"),e.createElement("p",{},"\n This example shows working with async events, the usage of regular event handler function pointers instead of lambda expression, and working with two-way binding.\n "),e.createElement(n,t.assign({},{id:"weatherExample",direction:"horizontal"},this.state.samples.weather))),e.createElement("div",{id:"rt-import",className:"example"},e.createElement("h3",{},"rt-import"),e.createElement("p",{},"\n This example shows how to load other React components and libraries into a React template and then use them within the template.\n "),e.createElement(r,t.assign({},{mode:"javascript"},this.state.rtImport))),e.createElement("div",{id:"amd",className:"example"},e.createElement("h3",{},"AMD"),e.createElement("p",{},"\n This example shows the rt-require sample output with AMD support.\n "),e.createElement(r,t.assign({},{mode:"javascript"},this.state.amd))),e.createElement("div",{id:"commonjs",className:"example"},e.createElement("h3",{},"CommonJS"),e.createElement("p",{},"\n This example shows the rt-require sample output with CommonJS support.\n "),e.createElement(r,t.assign({},{mode:"javascript"},this.state.cjs))),e.createElement("div",{id:"es6",className:"example"},e.createElement("h3",{},"ES6"),e.createElement("p",{},"\n This example shows the rt-require sample output with ES6 support.\n "),e.createElement(r,t.assign({},{mode:"javascript"},this.state.es6))))}}),define("text",["module"],function(e){"use strict";var t,n,r=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],i=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,s=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,o=typeof location!="undefined"&&location.href,u=o&&location.protocol&&location.protocol.replace(/\:/,""),a=o&&location.hostname,f=o&&(location.port||undefined),l=[],c=e.config&&e.config()||{};t={version:"2.0.5",strip:function(e){if(e){e=e.replace(i,"");var t=e.match(s);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:c.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=r[t];try{e=new ActiveXObject(n)}catch(i){}if(e){r=[n];break}}return e},parseName:function(e){var t,n,r,i=!1,s=e.indexOf("."),o=e.indexOf("./")===0||e.indexOf("../")===0;return s!==-1&&(!o||s>1)?(t=e.substring(0,s),n=e.substring(s+1,e.length)):t=e,r=n||t,s=r.indexOf("!"),s!==-1&&(i=r.substring(s+1)==="strip",r=r.substring(0,s),n?n=r:t=r),{moduleName:t,ext:n,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,c.isBuild&&(l[e]=r),i(r)},load:function(e,n,r,i){if(i.isBuild&&!i.inlineText){r();return}c.isBuild=i.isBuild;var s=t.parseName(e),l=s.moduleName+(s.ext?"."+s.ext:""),h=n.toUrl(l),p=c.useXhr||t.useXhr;!o||p(h,u,a,f)?t.get(h,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([l],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(l.hasOwnProperty(n)){var s=t.jsEscape(l[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.ext?"."+o.ext:"",a=o.moduleName+u,f=r.toUrl(o.moduleName+u)+".js";t.load(a,r,function(n){var r=function(e){return i(f,e)};r.asModule=function(e,t){return i.asModule(e,f,t)},t.write(e,a,r,s)},s)}};if(c.env==="node"||!c.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node)n=require.nodeRequire("fs"),t.get=function(e,t){var r=n.readFileSync(e,"utf8");r.indexOf("")===0&&(r=r.substring(1)),t(r)};else if(c.env==="xhr"||!c.env&&t.createXhr())t.get=function(e,n,r,i){var s=t.createXhr(),o;s.open("GET",e,!0);if(i)for(o in i)i.hasOwnProperty(o)&&s.setRequestHeader(o.toLowerCase(),i[o]);c.onXhr&&c.onXhr(s,e),s.onreadystatechange=function(t){var i,o;s.readyState===4&&(i=s.status,i>399&&i<600?(o=new Error(e+" HTTP status: "+i),o.xhr=s,r(o)):n(s.responseText))},s.send(null)};else if(c.env==="rhino"||!c.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};return t}),define("text!samples/hello.code",[],function(){return"var <%= name %> = React.createClass({\n render: <%= name %>RT\n});"}),define("text!samples/hello.rt",[],function(){return"<h2>Hello world</h2>\n"}),define("text!samples/todo.code",[],function(){return"var <%= name %> = React.createClass({\n mixins: [React.addons.LinkedStateMixin],\n getInitialState: function () {\n return {edited: '', todos: [], counter: 0};\n },\n add: function () {\n if (this.state.edited.trim().length === 0) {\n return;\n }\n var newTodo = {value: this.state.edited, done: false, key: this.state.counter};\n this.setState({todos: this.state.todos.concat(newTodo), edited: '', counter: this.state.counter + 1});\n },\n remove: function (todo) {\n this.setState({todos: _.reject(this.state.todos, todo)});\n },\n toggleChecked: function (index) {\n var todos = _.cloneDeep(this.state.todos);\n todos[index].done = !todos[index].done;\n this.setState({todos: todos});\n },\n clearDone: function () {\n this.setState({todos: this.getPending()});\n },\n getDone: function () {\n return _.filter(this.state.todos, {done: true});\n },\n getPending: function () {\n return _.filter(this.state.todos, {done: false});\n },\n render: <%= name %>RT\n});"}),define("text!samples/todo.rt",[],function(){return'<div>\n <strong>{this.getDone().length}</strong>\n done,\n <strong>{this.getPending().length}</strong>\n pending\n <br/>\n <div rt-repeat="todo in this.state.todos" key="{todo.key}">\n <img src="img/samples/delete.png"\n onClick="()=>this.remove(todo)"\n title="Remove Todo"\n style="cursor:pointer"/>\n <input type="checkbox" checked="{todo.done}"\n onChange="()=>this.toggleChecked(todoIndex)"/>\n <span style="text-decoration: {todo.done ? \'line-through\': \'none\'}">{todo.value}</span>\n </div>\n <input key="myinput" style="width:130px" type="text"\n onKeyDown="(e) => if (e.keyCode == 13) { e.preventDefault(); this.add(); }"\n valueLink="{this.linkState(\'edited\')}"/>\n <button onClick="()=>this.add()">Add</button><br/>\n <button onClick="()=>this.clearDone()">Clear done</button>\n</div>'}),define("text!samples/rt-if.code",[],function(){return"var <%= name %> = React.createClass({\n getInitialState: function () {\n return {open: false};\n },\n toggle: function() {\n this.setState({open: !this.state.open});\n },\n render: <%= name %>RT\n});"}),define("text!samples/rt-if.rt",[],function(){return'<div>\n <h4 style="cursor:pointer" onClick="()=>this.toggle()">\n Click to {this.state.open ? \'close\' : \'open\'}\n </h4>\n <p rt-if="this.state.open">This is my paragraph. It opens and\n closes</p>\n</div>'}),define("text!samples/rt-props.code",[],function(){return"var <%= name %> = React.createClass({\n mixins: [React.addons.LinkedStateMixin],\n getInitialState: function() {\n return { key: 'color', val: 'blue' };\n },\n getProps: function() {\n var ret = { style: {\n color: 'black',\n backgroundColor: 'white',\n borderColor: 'black'\n }};\n ret.style[this.state.key] = this.state.val;\n return ret;\n },\n render: <%= name %>RT\n});"}),define("text!samples/rt-props.rt",[],function(){return'<div>\n Style:\n <select valueLink="{this.linkState(\'key\')}">\n <option value="color">Color</option>\n <option value="backgroundColor">Background color</option>\n <option value="borderColor">Border color</option>\n </select><br/>\n Value:\n <select valueLink="{this.linkState(\'val\')}">\n <option value="blue">Blue</option>\n <option value="red">Red</option>\n <option value="yellow">Yellow</option>\n </select><br/><br/>\n <div style="padding:5px;text-align:center;border:1px solid"\n rt-props="this.getProps()">Sample</div>\n</div>'}),define("text!samples/rt-repeat.code",[],function(){return"var <%= name %> = React.createClass({\n getInitialState: function () {\n return {\n items: ['One', 'Two', 'Three']\n };\n },\n render: <%= name %>RT\n});"}),define("text!samples/rt-repeat.rt",[],function(){return'<div>\n <ul>\n <li rt-repeat="item in this.state.items">{item}</li>\n </ul>\n</div>'}),define("text!samples/weather.code",[],function(){return"var <%= name %> = React.createClass({\n mixins: [React.addons.LinkedStateMixin],\n getInitialState: function() {\n this.cityIds = [5391959,293397,2643743];\n this.fetchWeather();\n return { loading: true, cityToAdd: '', info: [] };\n },\n addCity: function() {\n if (this.state.cityToAdd.trim() == '') {\n return;\n }\n this.setState({ loading: true, cityToAdd: '' });\n $.get('http://api.openweathermap.org/data/2.5/weather?q=' + this.state.cityToAdd, this.findCityCallback);\n },\n findCityCallback: function(result) {\n if (result.id && !_.contains(this.cityIds, result.id)) {\n this.cityIds.unshift(result.id);\n this.fetchWeather();\n } else {\n this.setState({ loading: false });\n }\n },\n refresh: function() {\n this.setState({ loading:true });\n this.fetchWeather();\n },\n fetchWeather: function() {\n $.get('http://api.openweathermap.org/data/2.5/group?id=' + this.cityIds.join(',') + '&units=metric', this.fetchWeatherCallback);\n },\n fetchWeatherCallback: function(result) {\n this.setState({ loading:false, info: result.list });\n },\n render: <%= name %>RT\n});"}),define("text!samples/weather.rt",[],function(){return'<div>\n <h4>Cities weather report</h4>\n <input placeholder="Type a city to add"\n style="width:130px"\n valueLink="{this.linkState(\'cityToAdd\')}"\n onKeyDown="(e)=>if (e.keyCode === 13) { e.preventDefault(); this.addCity(); }"/>\n <button onClick="{this.addCity}">Add</button>\n <div key="preloader" rt-if="this.state.loading">\n -- Loading --\n </div>\n <div rt-repeat="city in this.state.info" key="{city.id}">\n {cityIndex+1})\n <img rt-repeat="weather in city.weather"\n src="http://openweathermap.org/img/w/{weather.icon}.png"\n title="{weather.description}"/>\n <span style="white-space:nowrap">{city.name}, {city.sys.country}</span>\n </div>\n <button onClick="{this.refresh}">Refresh</button>\n</div>'}),define("text!samples/rt-import.rt",[],function(){return'<rt-import name="myComp" from="comps" />\n<rt-import name="*" as="utils" from="utils/utils" />\n<div>\n <myComp customProp="{utils.doSomething()}">myComp is just a regular tag</myComp>\n</div>\n'}),define("examples",["lodash","react","./examples.rt","text!./samples/hello.code","text!./samples/hello.rt","text!./samples/todo.code","text!./samples/todo.rt","text!./samples/rt-if.code","text!./samples/rt-if.rt","text!./samples/rt-props.code","text!./samples/rt-props.rt","text!./samples/rt-repeat.code","text!./samples/rt-repeat.rt","text!./samples/weather.code","text!./samples/weather.rt","text!./samples/rt-import.rt"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v){"use strict";var m={hello:[r,i],todo:[s,o],props:[f,l],rtIf:[u,a],repeat:[c,h],weather:[p,d]};return m=e.mapValues(m,function(t,n){return{name:n,templateProps:e.template(t[0])({name:n}),templateHTML:t[1]}}),t.createClass({displayName:"Examples",mixins:[t.addons.LinkedStateMixin],getInitialState:function(){var e=window.reactTemplates.convertTemplateToReact(v,{modules:"amd",name:"template"}),t=window.reactTemplates.convertTemplateToReact(v,{modules:"commonjs",name:"template"}),n=window.reactTemplates.convertTemplateToReact(v,{modules:"es6",name:"template"});return{rtImport:{value:v},amd:{value:e},cjs:{value:t},es6:{value:n},samples:m}},render:n})}),requirejs.config({baseUrl:"./playground",paths:{lodash:"//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.0/lodash.min",jquery:"//code.jquery.com/jquery-2.1.4.min",firebase:"https://cdn.firebase.com/js/client/2.0.5/firebase",react:"//cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react-with-addons",text:"libs/requirejs-plugins/text",json:"libs/requirejs-plugins/json"},shim:{lodash:{exports:"_"},firebase:{exports:"Firebase"},jquery:{exports:"$"},react:{exports:"React"}},map:{"*":{"react/addons":"react"}}}),requirejs(["./examples","react","jquery"],function(e,t){"use strict";var n=t.createElement(e);t.render(n,document.getElementById("home-section"))}),define("home-main.js",function(){});