diff --git a/dist/bundle.js b/dist/bundle.js index 04488be6..69608898 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -1,4 +1,4 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="/static/",t(0)}([function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){b["default"].loggedIn()||t({pathname:"/login",state:{nextPathname:e.location.pathname}})}var a=n(4),s=i(a),l=n(89),u=n(51),c=n(97),f=n(77),d=n(306),p=r(d),h=n(299),m=i(h),g=n(79),v=i(g),y=n(37),b=i(y),x=n(147),w=i(x),C=n(151),_=i(C),k=n(155),E=i(k),S=n(153),T=i(S),M=p.reducer(w["default"]),O=(0,m["default"])("atlas-store"),N=p.createMiddleware(O),A=(0,f.applyMiddleware)(N)(f.createStore),P=A(M),L=p.createLoader(O);L(P),(0,l.render)(s["default"].createElement(u.Provider,{store:P},s["default"].createElement(c.Router,{history:v["default"]},s["default"].createElement(c.Route,{path:"/",component:_["default"]},s["default"].createElement(c.Route,{path:"login",component:E["default"]}),s["default"].createElement(c.Route,{path:"dashboard",component:T["default"],onEnter:o})))),document.getElementById("root"))},function(e,t,n){"use strict";function r(e,t,n,r,i,o,a,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,i,o,a,s],c=0;l=new Error(t.replace(/%s/g,function(){return u[c++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}e.exports=r},function(e,t,n){"use strict";var r=n(12),i=r;e.exports=i},function(e,t){"use strict";function n(e,t){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var n=Object(e),r=Object.prototype.hasOwnProperty,i=1;i2?n-2:0),i=2;n>i;i++)r[i-2]=arguments[i]}t.__esModule=!0,t["default"]=i;var o=n(13);r(o);e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function i(e){return e?e.nodeType===W?e.documentElement:e.firstChild:null}function o(e){var t=i(e);return t&&X.getID(t)}function a(e){var t=s(e);if(t)if(H.hasOwnProperty(t)){var n=H[t];n!==e&&(f(n,t)?I(!1):void 0,H[t]=e)}else H[t]=e;return t}function s(e){return e&&e.getAttribute&&e.getAttribute(B)||""}function l(e,t){var n=s(e);n!==t&&delete H[n],e.setAttribute(B,t),H[t]=e}function u(e){return H.hasOwnProperty(e)&&f(H[e],e)||(H[e]=X.findReactNodeByID(e)),H[e]}function c(e){var t=S.get(e)._rootNodeID;return k.isNullComponentID(t)?null:(H.hasOwnProperty(t)&&f(H[t],t)||(H[t]=X.findReactNodeByID(t)),H[t])}function f(e,t){if(e){s(e)!==t?I(!1):void 0;var n=X.findReactContainerForID(t);if(n&&D(n,e))return!0}return!1}function d(e){delete H[e]}function p(e){var t=H[e];return t&&f(t,e)?void(G=t):!1}function h(e){G=null,E.traverseAncestors(e,p);var t=G;return G=null,t}function m(e,t,n,r,i,o){C.useCreateElement&&(o=P({},o),n.nodeType===W?o[q]=n:o[q]=n.ownerDocument);var a=O.mountComponent(e,t,r,o);e._renderedComponent._topLevelWrapper=e,X._mountImageIntoNode(a,n,i,r)}function g(e,t,n,r,i){var o=A.ReactReconcileTransaction.getPooled(r);o.perform(m,null,e,t,n,o,r,i),A.ReactReconcileTransaction.release(o)}function v(e,t){for(O.unmountComponent(e),t.nodeType===W&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)}function y(e){var t=o(e);return t?t!==E.getReactRootIDFromNodeID(t):!1}function b(e){for(;e&&e.parentNode!==e;e=e.parentNode)if(1===e.nodeType){var t=s(e);if(t){var n,r=E.getReactRootIDFromNodeID(t),i=e;do if(n=s(i),i=i.parentNode,null==i)return null;while(n!==r);if(i===K[r])return e}}return null}var x=n(29),w=n(40),C=(n(16),n(111)),_=n(9),k=n(118),E=n(30),S=n(34),T=n(121),M=n(10),O=n(24),N=n(64),A=n(11),P=n(3),L=n(31),D=n(81),R=n(71),I=n(1),j=n(47),F=n(74),B=(n(76),n(2),x.ID_ATTRIBUTE_NAME),H={},U=1,W=9,z=11,q="__ReactMount_ownerDocument$"+Math.random().toString(36).slice(2),V={},K={},$=[],G=null,Y=function(){};Y.prototype.isReactComponent={},Y.prototype.render=function(){return this.props};var X={TopLevelWrapper:Y,_instancesByReactRootID:V,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){return X.scrollMonitor(n,function(){N.enqueueElementInternal(e,t),r&&N.enqueueCallbackInternal(e,r)}),e},_registerComponent:function(e,t){!t||t.nodeType!==U&&t.nodeType!==W&&t.nodeType!==z?I(!1):void 0,w.ensureScrollValueMonitoring();var n=X.registerContainer(t);return V[n]=e,n},_renderNewRootComponent:function(e,t,n,r){var i=R(e,null),o=X._registerComponent(i,t);return A.batchedUpdates(g,i,o,t,n,r),i},renderSubtreeIntoContainer:function(e,t,n,r){return null==e||null==e._reactInternalInstance?I(!1):void 0,X._renderSubtreeIntoContainer(e,t,n,r)},_renderSubtreeIntoContainer:function(e,t,n,r){_.isValidElement(t)?void 0:I(!1);var a=new _(Y,null,null,null,null,null,t),l=V[o(n)];if(l){var u=l._currentElement,c=u.props;if(F(c,t)){var f=l._renderedComponent.getPublicInstance(),d=r&&function(){r.call(f)};return X._updateRootComponent(l,a,n,d),f}X.unmountComponentAtNode(n)}var p=i(n),h=p&&!!s(p),m=y(n),g=h&&!l&&!m,v=X._renderNewRootComponent(a,n,g,null!=e?e._reactInternalInstance._processChildContext(e._reactInternalInstance._context):L)._renderedComponent.getPublicInstance();return r&&r.call(v),v},render:function(e,t,n){return X._renderSubtreeIntoContainer(null,e,t,n)},registerContainer:function(e){var t=o(e);return t&&(t=E.getReactRootIDFromNodeID(t)),t||(t=E.createReactRootID()),K[t]=e,t},unmountComponentAtNode:function(e){!e||e.nodeType!==U&&e.nodeType!==W&&e.nodeType!==z?I(!1):void 0;var t=o(e),n=V[t];if(!n){var r=(y(e),s(e));r&&r===E.getReactRootIDFromNodeID(r);return!1}return A.batchedUpdates(v,n,e),delete V[t],delete K[t],!0},findReactContainerForID:function(e){var t=E.getReactRootIDFromNodeID(e),n=K[t];return n},findReactNodeByID:function(e){var t=X.findReactContainerForID(e);return X.findComponentRoot(t,e)},getFirstReactDOM:function(e){return b(e)},findComponentRoot:function(e,t){var n=$,r=0,i=h(t)||e;for(n[0]=i.firstChild,n.length=1;r1){for(var p=Array(d),h=0;d>h;h++)p[h]=arguments[h+2];o.children=p}if(e&&e.defaultProps){var m=e.defaultProps;for(i in m)"undefined"==typeof o[i]&&(o[i]=m[i])}return s(e,l,u,c,f,r.current,o)},s.createFactory=function(e){var t=s.createElement.bind(null,e);return t.type=e,t},s.cloneAndReplaceKey=function(e,t){var n=s(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n},s.cloneAndReplaceProps=function(e,t){var n=s(e.type,e.key,e.ref,e._self,e._source,e._owner,t);return n},s.cloneElement=function(e,t,n){var o,l=i({},e.props),u=e.key,c=e.ref,f=e._self,d=e._source,p=e._owner;if(null!=t){void 0!==t.ref&&(c=t.ref,p=r.current),void 0!==t.key&&(u=""+t.key);for(o in t)t.hasOwnProperty(o)&&!a.hasOwnProperty(o)&&(l[o]=t[o])}var h=arguments.length-2;if(1===h)l.children=n;else if(h>1){for(var m=Array(h),g=0;h>g;g++)m[g]=arguments[g+2];l.children=m}return s(e.type,u,c,f,d,p,l)},s.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},e.exports=s},function(e,t,n){"use strict";function r(e,t,n){return n}var i={enableMeasure:!1,storedMeasure:r,measureMethods:function(e,t,n){},measure:function(e,t,n){return n},injection:{injectMeasure:function(e){i.storedMeasure=e}}};e.exports=i},function(e,t,n){"use strict";function r(){S.ReactReconcileTransaction&&x?void 0:g(!1)}function i(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=c.getPooled(),this.reconcileTransaction=S.ReactReconcileTransaction.getPooled(!1)}function o(e,t,n,i,o,a){r(),x.batchedUpdates(e,t,n,i,o,a)}function a(e,t){return e._mountOrder-t._mountOrder}function s(e){var t=e.dirtyComponentsLength;t!==v.length?g(!1):void 0,v.sort(a);for(var n=0;t>n;n++){var r=v[n],i=r._pendingCallbacks;if(r._pendingCallbacks=null,p.performUpdateIfNecessary(r,e.reconcileTransaction),i)for(var o=0;o=0&&b.splice(t,1)}function s(e){var t=document.createElement("style");return t.type="text/css",o(e,t),t}function l(e){var t=document.createElement("link");return t.rel="stylesheet",o(e,t),t}function u(e,t){var n,r,i;if(t.singleton){var o=y++;n=v||(v=s(t)),r=c.bind(null,n,o,!1),i=c.bind(null,n,o,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=l(t),r=d.bind(null,n),i=function(){a(n),n.href&&URL.revokeObjectURL(n.href)}):(n=s(t),r=f.bind(null,n),i=function(){a(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}function c(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=x(t,i);else{var o=document.createTextNode(i),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(o,a[t]):e.appendChild(o)}}function f(e,t){var n=t.css,r=t.media;t.sourceMap;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function d(e,t){var n=t.css,r=(t.media,t.sourceMap);r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var i=new Blob([n],{type:"text/css"}),o=e.href;e.href=URL.createObjectURL(i),o&&URL.revokeObjectURL(o)}var p={},h=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},m=h(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),g=h(function(){return document.head||document.getElementsByTagName("head")[0]}),v=null,y=0,b=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=m()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=i(e);return r(n,t),function(e){for(var o=[],a=0;axo&&setTimeout(function(){l.display.input.reset(!0)},20),Wt(this),Yi(),xt(this),this.curOp.forceUpdate=!0,Xr(this,i),r.autofocus&&!Oo||l.hasFocus()?setTimeout(Fi(vn,this),20):yn(this);for(var c in ea)ea.hasOwnProperty(c)&&ea[c](this,r[c],ta);C(this),r.finishInit&&r.finishInit(this);for(var f=0;fxo&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),wo||go&&Oo||(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,n.init(r)}function n(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),r(t)}function r(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Be(e,100),e.state.modeGen++,e.curOp&&Rt(e)}function i(e){e.options.lineWrapping?(Qa(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Xa(e.display.wrapper,"CodeMirror-wrap"),d(e)),a(e),Rt(e),st(e),setTimeout(function(){y(e)},100)}function o(e){var t=yt(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/bt(e.display)-3);return function(i){if(Cr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;at.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function p(e){var t=Li(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function h(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+qe(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ke(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function m(e,t,n){this.cm=n;var r=this.vert=Wi("div",[Wi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Wi("div",[Wi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(r),e(i),Oa(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Oa(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,bo&&8>xo&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Xa(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Oa(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?on(t,e):rn(t,e)},t),t.display.scrollbars.addClass&&Qa(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=h(e));var n=e.display.barWidth,r=e.display.barHeight;b(e,t);for(var i=0;4>i&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&A(e),b(e,h(e)),n=e.display.barWidth,r=e.display.barHeight}function b(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function x(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-ze(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=ni(t,r),a=ni(t,i);if(n&&n.ensure){var s=n.ensure.from.line,l=n.ensure.to.line;o>s?(o=s,a=ni(t,ri(Qr(t,s))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=a&&(o=ni(t,ri(Qr(t,l))-e.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function w(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=k(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Ut(e))return!1;C(e)&&(jt(e),t.dims=L(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Io&&(o=xr(e.doc,o),a=wr(e.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Ht(e,o,a),n.viewOffset=ri(Qr(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var l=Ut(e);if(!s&&0==l&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=Vi();return l>4&&(n.lineDiv.style.display="none"),D(e,n.updateLineNumbers,t.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,u&&Vi()!=u&&u.offsetHeight&&u.focus(),zi(n.cursorDiv),zi(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Be(e,400)),n.updateLineNumbers=null,!0}function M(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=$e(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+qe(e.display)-Ge(e),n.top)}),t.visible=x(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&T(e,t);r=!1){A(e);var i=h(e);De(e),N(e,i),y(e,i)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function O(e,t){var n=new E(e,t);if(T(e,n)){A(e),M(e,n);var r=h(e);De(e),N(e,r),y(e,r),n.finish()}}function N(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var n=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=n+"px",e.display.gutters.style.height=Math.max(n+Ke(e),t.clientHeight)+"px"}function A(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;rxo){var a=o.node.offsetTop+o.node.offsetHeight;i=a-n,n=a}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var l=o.line.height-i;if(2>i&&(i=yt(t)),(l>.001||-.001>l)&&(ei(o.line,i),P(o.line),o.rest))for(var u=0;u=t&&f.lineNumber;f.changes&&(Li(f.changes,"gutter")>-1&&(d=!1),R(e,f,u,n)),d&&(zi(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(_(e.options,u)))),s=f.node.nextSibling}else{var p=z(e,f,u,n);a.insertBefore(p,s)}u+=f.size}for(;s;)s=r(s)}function R(e,t,n,r){for(var i=0;ixo&&(e.node.style.zIndex=2)),e.node}function j(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var n=I(e);e.background=n.insertBefore(Wi("div",null,t),n.firstChild)}}function F(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Fr(e,t)}function B(e,t){var n=t.text.className,r=F(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,H(t)):n&&(t.text.className=n)}function H(e){j(e),e.line.wrapClass?I(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 U(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=I(t);t.gutterBackground=Wi("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"), +!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="/static/",t(0)}([function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){b["default"].loggedIn()||t({pathname:"/login",state:{nextPathname:e.location.pathname}})}var a=n(4),s=i(a),l=n(89),u=n(51),c=n(97),f=n(77),d=n(306),p=r(d),h=n(299),m=i(h),g=n(79),v=i(g),y=n(37),b=i(y),x=n(147),w=i(x),C=n(151),_=(i(C),n(155)),k=i(_),E=n(153),S=i(E),T=p.reducer(w["default"]),M=(0,m["default"])("atlas-store"),O=p.createMiddleware(M),N=(0,f.applyMiddleware)(O)(f.createStore),A=N(T),P=p.createLoader(M);P(A),(0,l.render)(s["default"].createElement(u.Provider,{store:A},s["default"].createElement(c.Router,{history:v["default"]},s["default"].createElement(c.Route,{path:"/",component:S["default"]},s["default"].createElement(c.Route,{path:"login",component:k["default"]}),s["default"].createElement(c.Route,{path:"dashboard",component:S["default"],onEnter:o})))),document.getElementById("root"))},function(e,t,n){"use strict";function r(e,t,n,r,i,o,a,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,i,o,a,s],c=0;l=new Error(t.replace(/%s/g,function(){return u[c++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}e.exports=r},function(e,t,n){"use strict";var r=n(12),i=r;e.exports=i},function(e,t){"use strict";function n(e,t){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var n=Object(e),r=Object.prototype.hasOwnProperty,i=1;i2?n-2:0),i=2;n>i;i++)r[i-2]=arguments[i]}t.__esModule=!0,t["default"]=i;var o=n(13);r(o);e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function i(e){return e?e.nodeType===W?e.documentElement:e.firstChild:null}function o(e){var t=i(e);return t&&X.getID(t)}function a(e){var t=s(e);if(t)if(H.hasOwnProperty(t)){var n=H[t];n!==e&&(f(n,t)?I(!1):void 0,H[t]=e)}else H[t]=e;return t}function s(e){return e&&e.getAttribute&&e.getAttribute(B)||""}function l(e,t){var n=s(e);n!==t&&delete H[n],e.setAttribute(B,t),H[t]=e}function u(e){return H.hasOwnProperty(e)&&f(H[e],e)||(H[e]=X.findReactNodeByID(e)),H[e]}function c(e){var t=S.get(e)._rootNodeID;return k.isNullComponentID(t)?null:(H.hasOwnProperty(t)&&f(H[t],t)||(H[t]=X.findReactNodeByID(t)),H[t])}function f(e,t){if(e){s(e)!==t?I(!1):void 0;var n=X.findReactContainerForID(t);if(n&&D(n,e))return!0}return!1}function d(e){delete H[e]}function p(e){var t=H[e];return t&&f(t,e)?void(G=t):!1}function h(e){G=null,E.traverseAncestors(e,p);var t=G;return G=null,t}function m(e,t,n,r,i,o){C.useCreateElement&&(o=P({},o),n.nodeType===W?o[q]=n:o[q]=n.ownerDocument);var a=O.mountComponent(e,t,r,o);e._renderedComponent._topLevelWrapper=e,X._mountImageIntoNode(a,n,i,r)}function g(e,t,n,r,i){var o=A.ReactReconcileTransaction.getPooled(r);o.perform(m,null,e,t,n,o,r,i),A.ReactReconcileTransaction.release(o)}function v(e,t){for(O.unmountComponent(e),t.nodeType===W&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)}function y(e){var t=o(e);return t?t!==E.getReactRootIDFromNodeID(t):!1}function b(e){for(;e&&e.parentNode!==e;e=e.parentNode)if(1===e.nodeType){var t=s(e);if(t){var n,r=E.getReactRootIDFromNodeID(t),i=e;do if(n=s(i),i=i.parentNode,null==i)return null;while(n!==r);if(i===K[r])return e}}return null}var x=n(29),w=n(40),C=(n(16),n(111)),_=n(9),k=n(118),E=n(30),S=n(34),T=n(121),M=n(10),O=n(24),N=n(64),A=n(11),P=n(3),L=n(31),D=n(81),R=n(71),I=n(1),j=n(47),F=n(74),B=(n(76),n(2),x.ID_ATTRIBUTE_NAME),H={},U=1,W=9,z=11,q="__ReactMount_ownerDocument$"+Math.random().toString(36).slice(2),V={},K={},$=[],G=null,Y=function(){};Y.prototype.isReactComponent={},Y.prototype.render=function(){return this.props};var X={TopLevelWrapper:Y,_instancesByReactRootID:V,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){return X.scrollMonitor(n,function(){N.enqueueElementInternal(e,t),r&&N.enqueueCallbackInternal(e,r)}),e},_registerComponent:function(e,t){!t||t.nodeType!==U&&t.nodeType!==W&&t.nodeType!==z?I(!1):void 0,w.ensureScrollValueMonitoring();var n=X.registerContainer(t);return V[n]=e,n},_renderNewRootComponent:function(e,t,n,r){var i=R(e,null),o=X._registerComponent(i,t);return A.batchedUpdates(g,i,o,t,n,r),i},renderSubtreeIntoContainer:function(e,t,n,r){return null==e||null==e._reactInternalInstance?I(!1):void 0,X._renderSubtreeIntoContainer(e,t,n,r)},_renderSubtreeIntoContainer:function(e,t,n,r){_.isValidElement(t)?void 0:I(!1);var a=new _(Y,null,null,null,null,null,t),l=V[o(n)];if(l){var u=l._currentElement,c=u.props;if(F(c,t)){var f=l._renderedComponent.getPublicInstance(),d=r&&function(){r.call(f)};return X._updateRootComponent(l,a,n,d),f}X.unmountComponentAtNode(n)}var p=i(n),h=p&&!!s(p),m=y(n),g=h&&!l&&!m,v=X._renderNewRootComponent(a,n,g,null!=e?e._reactInternalInstance._processChildContext(e._reactInternalInstance._context):L)._renderedComponent.getPublicInstance();return r&&r.call(v),v},render:function(e,t,n){return X._renderSubtreeIntoContainer(null,e,t,n)},registerContainer:function(e){var t=o(e);return t&&(t=E.getReactRootIDFromNodeID(t)),t||(t=E.createReactRootID()),K[t]=e,t},unmountComponentAtNode:function(e){!e||e.nodeType!==U&&e.nodeType!==W&&e.nodeType!==z?I(!1):void 0;var t=o(e),n=V[t];if(!n){var r=(y(e),s(e));r&&r===E.getReactRootIDFromNodeID(r);return!1}return A.batchedUpdates(v,n,e),delete V[t],delete K[t],!0},findReactContainerForID:function(e){var t=E.getReactRootIDFromNodeID(e),n=K[t];return n},findReactNodeByID:function(e){var t=X.findReactContainerForID(e);return X.findComponentRoot(t,e)},getFirstReactDOM:function(e){return b(e)},findComponentRoot:function(e,t){var n=$,r=0,i=h(t)||e;for(n[0]=i.firstChild,n.length=1;r1){for(var p=Array(d),h=0;d>h;h++)p[h]=arguments[h+2];o.children=p}if(e&&e.defaultProps){var m=e.defaultProps;for(i in m)"undefined"==typeof o[i]&&(o[i]=m[i])}return s(e,l,u,c,f,r.current,o)},s.createFactory=function(e){var t=s.createElement.bind(null,e);return t.type=e,t},s.cloneAndReplaceKey=function(e,t){var n=s(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n},s.cloneAndReplaceProps=function(e,t){var n=s(e.type,e.key,e.ref,e._self,e._source,e._owner,t);return n},s.cloneElement=function(e,t,n){var o,l=i({},e.props),u=e.key,c=e.ref,f=e._self,d=e._source,p=e._owner;if(null!=t){void 0!==t.ref&&(c=t.ref,p=r.current),void 0!==t.key&&(u=""+t.key);for(o in t)t.hasOwnProperty(o)&&!a.hasOwnProperty(o)&&(l[o]=t[o])}var h=arguments.length-2;if(1===h)l.children=n;else if(h>1){for(var m=Array(h),g=0;h>g;g++)m[g]=arguments[g+2];l.children=m}return s(e.type,u,c,f,d,p,l)},s.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},e.exports=s},function(e,t,n){"use strict";function r(e,t,n){return n}var i={enableMeasure:!1,storedMeasure:r,measureMethods:function(e,t,n){},measure:function(e,t,n){return n},injection:{injectMeasure:function(e){i.storedMeasure=e}}};e.exports=i},function(e,t,n){"use strict";function r(){S.ReactReconcileTransaction&&x?void 0:g(!1)}function i(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=c.getPooled(),this.reconcileTransaction=S.ReactReconcileTransaction.getPooled(!1)}function o(e,t,n,i,o,a){r(),x.batchedUpdates(e,t,n,i,o,a)}function a(e,t){return e._mountOrder-t._mountOrder}function s(e){var t=e.dirtyComponentsLength;t!==v.length?g(!1):void 0,v.sort(a);for(var n=0;t>n;n++){var r=v[n],i=r._pendingCallbacks;if(r._pendingCallbacks=null,p.performUpdateIfNecessary(r,e.reconcileTransaction),i)for(var o=0;o=0&&b.splice(t,1)}function s(e){var t=document.createElement("style");return t.type="text/css",o(e,t),t}function l(e){var t=document.createElement("link");return t.rel="stylesheet",o(e,t),t}function u(e,t){var n,r,i;if(t.singleton){var o=y++;n=v||(v=s(t)),r=c.bind(null,n,o,!1),i=c.bind(null,n,o,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=l(t),r=d.bind(null,n),i=function(){a(n),n.href&&URL.revokeObjectURL(n.href)}):(n=s(t),r=f.bind(null,n),i=function(){a(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}function c(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=x(t,i);else{var o=document.createTextNode(i),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(o,a[t]):e.appendChild(o)}}function f(e,t){var n=t.css,r=t.media;t.sourceMap;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function d(e,t){var n=t.css,r=(t.media,t.sourceMap);r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var i=new Blob([n],{type:"text/css"}),o=e.href;e.href=URL.createObjectURL(i),o&&URL.revokeObjectURL(o)}var p={},h=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},m=h(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),g=h(function(){return document.head||document.getElementsByTagName("head")[0]}),v=null,y=0,b=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=m()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=i(e);return r(n,t),function(e){for(var o=[],a=0;axo&&setTimeout(function(){l.display.input.reset(!0)},20),Wt(this),Yi(),xt(this),this.curOp.forceUpdate=!0,Xr(this,i),r.autofocus&&!Oo||l.hasFocus()?setTimeout(Fi(vn,this),20):yn(this);for(var c in ea)ea.hasOwnProperty(c)&&ea[c](this,r[c],ta);C(this),r.finishInit&&r.finishInit(this);for(var f=0;fxo&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),wo||go&&Oo||(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,n.init(r)}function n(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),r(t)}function r(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Be(e,100),e.state.modeGen++,e.curOp&&Rt(e)}function i(e){e.options.lineWrapping?(Qa(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Xa(e.display.wrapper,"CodeMirror-wrap"),d(e)),a(e),Rt(e),st(e),setTimeout(function(){y(e)},100)}function o(e){var t=yt(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/bt(e.display)-3);return function(i){if(Cr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;at.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function p(e){var t=Li(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function h(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+qe(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ke(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function m(e,t,n){this.cm=n;var r=this.vert=Wi("div",[Wi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Wi("div",[Wi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(r),e(i),Oa(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Oa(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,bo&&8>xo&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Xa(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Oa(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?on(t,e):rn(t,e)},t),t.display.scrollbars.addClass&&Qa(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=h(e));var n=e.display.barWidth,r=e.display.barHeight;b(e,t);for(var i=0;4>i&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&A(e),b(e,h(e)),n=e.display.barWidth,r=e.display.barHeight}function b(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function x(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-ze(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=ni(t,r),a=ni(t,i);if(n&&n.ensure){var s=n.ensure.from.line,l=n.ensure.to.line;o>s?(o=s,a=ni(t,ri(Qr(t,s))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=a&&(o=ni(t,ri(Qr(t,l))-e.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function w(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=k(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Ut(e))return!1;C(e)&&(jt(e),t.dims=L(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Io&&(o=xr(e.doc,o),a=wr(e.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Ht(e,o,a),n.viewOffset=ri(Qr(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var l=Ut(e);if(!s&&0==l&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=Vi();return l>4&&(n.lineDiv.style.display="none"),D(e,n.updateLineNumbers,t.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,u&&Vi()!=u&&u.offsetHeight&&u.focus(),zi(n.cursorDiv),zi(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Be(e,400)),n.updateLineNumbers=null,!0}function M(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=$e(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+qe(e.display)-Ge(e),n.top)}),t.visible=x(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&T(e,t);r=!1){A(e);var i=h(e);De(e),N(e,i),y(e,i)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function O(e,t){var n=new E(e,t);if(T(e,n)){A(e),M(e,n);var r=h(e);De(e),N(e,r),y(e,r),n.finish()}}function N(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var n=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=n+"px",e.display.gutters.style.height=Math.max(n+Ke(e),t.clientHeight)+"px"}function A(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;rxo){var a=o.node.offsetTop+o.node.offsetHeight;i=a-n,n=a}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var l=o.line.height-i;if(2>i&&(i=yt(t)),(l>.001||-.001>l)&&(ei(o.line,i),P(o.line),o.rest))for(var u=0;u=t&&f.lineNumber;f.changes&&(Li(f.changes,"gutter")>-1&&(d=!1),R(e,f,u,n)),d&&(zi(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(_(e.options,u)))),s=f.node.nextSibling}else{var p=z(e,f,u,n);a.insertBefore(p,s)}u+=f.size}for(;s;)s=r(s)}function R(e,t,n,r){for(var i=0;ixo&&(e.node.style.zIndex=2)),e.node}function j(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var n=I(e);e.background=n.insertBefore(Wi("div",null,t),n.firstChild)}}function F(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Fr(e,t)}function B(e,t){var n=t.text.className,r=F(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,H(t)):n&&(t.text.className=n)}function H(e){j(e),e.line.wrapClass?I(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 U(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=I(t);t.gutterBackground=Wi("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"), i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=I(t),a=t.gutter=Wi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(Wi("div",_(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s1)if(Bo&&Bo.join("\n")==t){if(r.ranges.length%Bo.length==0){l=[];for(var u=0;u=0;u--){var c=r.ranges[u],f=c.from(),d=c.to();c.empty()&&(n&&n>0?f=jo(f.line,f.ch-n):e.state.overwrite&&!a&&(d=jo(d.line,Math.min(Qr(o,d.line).text.length,d.ch+Pi(s).length))));var p=e.curOp.updateInput,h={from:f,to:d,text:l?l[u%l.length]:s,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Sn(e.doc,h),ki(e,"inputRead",e,h)}t&&!a&&J(e,t),Fn(e),e.curOp.updateInput=p,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Z(e,t){var n=e.clipboardData&&e.clipboardData.getData("text/plain");return n?(e.preventDefault(),t.isReadOnly()||t.options.disableInput||Ot(t,function(){Q(t,n,0,null,"paste")}),!0):void 0}function J(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=Hn(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Qr(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Hn(e,i.head.line,"smart"));a&&ki(e,"electricInput",e,i.head.line)}}}function ee(e){for(var t=[],n=[],r=0;ri?u.map:c[i],a=0;ai?e.line:e.rest[i]),f=o[a]+r;return(0>r||s!=t)&&(f=o[a+(r?1:0)]),jo(l,f)}}}var i=e.text.firstChild,o=!1;if(!t||!$a(i,t))return ae(jo(ti(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[n],n=0,!t)){var a=e.rest?Pi(e.rest):e.line;return ae(jo(ti(a),a.text.length),o)}var s=3==t.nodeType?t:null,l=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,n&&(n=s.nodeValue.length));l.parentNode!=i;)l=l.parentNode;var u=e.measure,c=u.maps,f=r(s,l,n);if(f)return ae(f,o);for(var d=l.nextSibling,p=s?s.nodeValue.length-n:0;d;d=d.nextSibling){if(f=r(d,d.firstChild,0))return ae(jo(f.line,f.ch-p),o);p+=d.textContent.length}for(var h=l.previousSibling,p=n;h;h=h.previousSibling){if(f=r(h,h.firstChild,-1))return ae(jo(f.line,f.ch+p),o);p+=d.textContent.length}}function ue(e,t,n,r,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(null!=n)return""==n&&(n=t.textContent.replace(/\u200b/g,"")),void(s+=n);var c,f=t.getAttribute("cm-marker");if(f){var d=e.findMarks(jo(r,0),jo(i+1,0),o(+f));return void(d.length&&(c=d[0].find())&&(s+=Zr(e.doc,c.from,c.to).join(u)))}if("false"==t.getAttribute("contenteditable"))return;for(var p=0;p=0){var a=Y(o.from(),i.from()),s=G(o.to(),i.to()),l=o.empty()?i.from()==i.head:o.from()==o.head;t>=r&&--t,e.splice(--r,2,new fe(l?s:a,l?a:s))}}return new ce(e,t)}function pe(e,t){return new ce([new fe(e,t||e)],0)}function he(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function me(e,t){if(t.linen?jo(n,Qr(e,n).text.length):ge(t,Qr(e,t.line).text.length)}function ge(e,t){var n=e.ch;return null==n||n>t?jo(e.line,t):0>n?jo(e.line,0):e}function ve(e,t){return t>=e.first&&t=t.ch:s.to>t.ch))){if(i&&(Pa(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var u,c=l.find(0>r?1:-1);if((0>r?l.inclusiveRight:l.inclusiveLeft)&&(c=Le(e,c,-r,o)),c&&c.line==t.line&&(u=Fo(c,n))&&(0>r?0>u:u>0))return Ae(e,c,t,r,i)}var f=l.find(0>r?-1:1);return(0>r?l.inclusiveLeft:l.inclusiveRight)&&(f=Le(e,f,r,o)),f?Ae(e,f,t,r,i):null}}return t}function Pe(e,t,n,r,i){var o=r||1,a=Ae(e,t,n,o,i)||!i&&Ae(e,t,n,o,!0)||Ae(e,t,n,-o,i)||!i&&Ae(e,t,n,-o,!0);return a?a:(e.cantEdit=!0,jo(e.first,0))}function Le(e,t,n,r){return 0>n&&0==t.ch?t.line>e.first?me(e,jo(t.line-1)):null:n>0&&t.ch==(r||Qr(e,t.line)).text.length?t.linet&&(t=0),t=Math.round(t),r=Math.round(r),s.appendChild(Wi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==n?c-e:n)+"px; height: "+(r-t)+"px"))}function i(t,n,i){function o(n,r){return dt(e,jo(t,n),"div",f,r)}var s,l,f=Qr(a,t),d=f.text.length;return eo(ii(f),n||0,null==i?d:i,function(e,t,a){var f,p,h,m=o(e,"left");if(e==t)f=m,p=h=m.left;else{if(f=o(t-1,"right"),"rtl"==a){var g=m;m=f,f=g}p=m.left,h=f.right}null==n&&0==e&&(p=u),f.top-m.top>3&&(r(p,m.top,null,m.bottom),p=u,m.bottoml.bottom||f.bottom==l.bottom&&f.right>l.right)&&(l=f),u+1>p&&(p=u),r(p,f.top,h-p,f.bottom)}),{start:s,end:l}}var o=e.display,a=e.doc,s=document.createDocumentFragment(),l=Ve(e.display),u=l.left,c=Math.max(o.sizerWidth,$e(e)-o.sizer.offsetLeft)-l.right,f=t.from(),d=t.to();if(f.line==d.line)i(f.line,f.ch,d.ch);else{var p=Qr(a,f.line),h=Qr(a,d.line),m=yr(p)==yr(h),g=i(f.line,f.ch,m?p.text.length+1:null).end,v=i(d.line,m?0:null,d.ch).start;m&&(g.top0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Be(e,t){e.doc.mode.startState&&e.doc.frontier=e.display.viewTo)){var n=+new Date+e.options.workTime,r=sa(t.mode,We(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength,l=Dr(e,o,s?sa(t.mode,r):r,!0);o.styles=l.styles;var u=o.styleClasses,c=l.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var f=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),d=0;!f&&dn?(Be(e,e.options.workDelay),!0):void 0}),i.length&&Ot(e,function(){for(var t=0;ta;--s){if(s<=o.first)return o.first;var l=Qr(o,s-1);if(l.stateAfter&&(!n||s<=o.frontier))return s;var u=Ba(l.text,null,e.options.tabSize);(null==i||r>u)&&(i=s-1,r=u)}return i}function We(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var o=Ue(e,t,n),a=o>r.first&&Qr(r,o-1).stateAfter;return a=a?sa(r.mode,a):la(r.mode),r.iter(o,t,function(n){Ir(e,n.text,a);var s=o==t-1||o%5==0||o>=i.viewFrom&&o2&&o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Xe(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Qe(e,t){t=yr(t);var n=ti(t),r=e.display.externalMeasured=new Lt(e.doc,t,n);r.lineN=n;var i=r.built=Fr(e,r);return r.text=i.pre,qi(e.display.lineMeasure,i.pre),r}function Ze(e,t,n,r){return tt(e,et(e,t),n,r)}function Je(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt?(i=0,o=1,a="left"):u>t?(i=t-l,o=i+1):(s==e.length-3||t==u&&e[s+3]>t)&&(o=u-l,i=o-1,t>=u&&(a="right")),null!=i){if(r=e[s+2],l==u&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)r=e[(s-=3)+2],a="left";if("right"==n&&i==u-l)for(;sc;c++){for(;s&&Ui(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+lxo&&0==s&&l==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(bo&&e.options.lineWrapping){var f=za(a,s,l).getClientRects();i=f.length?f["right"==r?f.length-1:0]:zo}else i=za(a,s,l).getBoundingClientRect()||zo;if(i.left||i.right||0==s)break;l=s,s-=1,u="right"}bo&&11>xo&&(i=it(e.display.measure,i))}else{s>0&&(u=r="right");var f;i=e.options.lineWrapping&&(f=a.getClientRects()).length>1?f["right"==r?f.length-1:0]:a.getBoundingClientRect()}if(bo&&9>xo&&!s&&(!i||!i.left&&!i.right)){var d=a.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+bt(e.display),top:d.top,bottom:d.bottom}:zo}for(var p=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(p+h)/2,g=t.view.measure.heights,c=0;cn.from?a(e-1):a(e,r)}r=r||Qr(e.doc,t.line),i||(i=et(e,r));var l=ii(r),u=t.ch;if(!l)return a(u);var c=uo(l,u),f=s(u,c);return null!=os&&(f.other=s(u,os)),f}function ht(e,t){var n=0,t=me(e.doc,t);e.options.lineWrapping||(n=bt(e.display)*t.ch);var r=Qr(e.doc,t.line),i=ri(r)+ze(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function mt(e,t,n,r){var i=jo(e,t);return i.xRel=r,n&&(i.outside=!0),i}function gt(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,0>n)return mt(r.first,0,!0,-1);var i=ni(r,n),o=r.first+r.size-1;if(i>o)return mt(r.first+r.size-1,Qr(r,o).text.length,!0,1);0>t&&(t=0);for(var a=Qr(r,i);;){var s=vt(e,a,i,t,n),l=gr(a),u=l&&l.find(0,!0);if(!l||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=ti(a=u.to.line)}}function vt(e,t,n,r,i){function o(r){var i=pt(e,jo(n,r),"line",t,u);return s=!0,a>i.bottom?i.left-l:ag)return mt(n,p,v,1);for(;;){if(c?p==d||p==fo(t,d,1):1>=p-d){for(var y=h>r||g-r>=r-h?d:p,b=r-(y==d?h:g);Ui(t.text.charAt(y));)++y;var x=mt(n,y,y==d?m:v,-1>b?-1:b>1?1:0);return x}var w=Math.ceil(f/2),C=d+w;if(c){C=d;for(var _=0;w>_;++_)C=fo(t,C,1)}var k=o(C);k>r?(p=C,g=k,(v=s)&&(g+=1e3),f=w):(d=C,h=k,m=s,f-=w)}}function yt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ho){Ho=Wi("pre");for(var t=0;49>t;++t)Ho.appendChild(document.createTextNode("x")),Ho.appendChild(Wi("br"));Ho.appendChild(document.createTextNode("x"))}qi(e.measure,Ho);var n=Ho.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),zi(e.measure),n||1}function bt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Wi("span","xxxxxxxxxx"),n=Wi("pre",[t]);qi(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function xt(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,focus:!1,id:++Vo},qo?qo.ops.push(e.curOp):e.curOp.ownsGroup=qo={ops:[e.curOp],delayedCallbacks:[]}}function wt(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new E(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Et(e){e.updatedDisplay=e.mustUpdate&&T(e.cm,e.update)}function St(e){var t=e.cm,n=t.display;e.updatedDisplay&&A(t),e.barMeasure=h(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ze(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ke(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-$e(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Tt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLefto;o=r){var a=new Lt(e.doc,Qr(e.doc,o),o);r=o+a.size,i.push(a)}return i}function Rt(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&nt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Io&&xr(e.doc,t)i.viewFrom?jt(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)jt(e);else if(t<=i.viewFrom){var o=Bt(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):jt(e)}else if(n>=i.viewTo){var o=Bt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):jt(e)}else{var a=Bt(e,t,t,-1),s=Bt(e,n,n+r,1);a&&s?(i.view=i.view.slice(0,a.index).concat(Dt(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):jt(e)}var l=i.externalMeasured;l&&(n=i.lineN&&t=r.viewTo)){var o=r.view[Ft(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Li(a,n)&&a.push(n)}}}function jt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ft(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var n=e.display.view,r=0;rt)return r}function Bt(e,t,n,r){var i,o=Ft(e,t),a=e.display.view;if(!Io||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var s=0,l=e.display.viewFrom;o>s;s++)l+=a[s].size;if(l!=t){if(r>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,n+=i}for(;xr(e.doc,n)!=n;){if(o==(0>r?0:a.length-1))return null;n+=r*a[o-(0>r?1:0)].size,o+=r}return{index:o,lineN:n}}function Ht(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=Dt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Dt(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Ft(e,n)))),r.viewTo=n}function Ut(e){for(var t=e.display.view,n=0,r=0;r400}var i=e.display;Oa(i.scroller,"mousedown",Nt(e,$t)),bo&&11>xo?Oa(i.scroller,"dblclick",Nt(e,function(t){if(!Si(e,t)){var n=Kt(e,t);if(n&&!Zt(e,t)&&!Vt(e.display,t)){Sa(t);var r=e.findWordAt(n);xe(e.doc,r.anchor,r.head)}}})):Oa(i.scroller,"dblclick",function(t){Si(e,t)||Sa(t)}),Do||Oa(i.scroller,"contextmenu",function(t){bn(e,t)});var o,a={end:0};Oa(i.scroller,"touchstart",function(t){if(!Si(e,t)&&!n(t)){clearTimeout(o);var r=+new Date;i.activeTouch={start:r,moved:!1,prev:r-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Oa(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Oa(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!Vt(i,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=e.coordsChar(i.activeTouch,"page");a=!o.prev||r(o,o.prev)?new fe(s,s):!o.prev.prev||r(o,o.prev.prev)?e.findWordAt(s):new fe(jo(s.line,0),me(e.doc,jo(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),Sa(n)}t()}),Oa(i.scroller,"touchcancel",t),Oa(i.scroller,"scroll",function(){i.scroller.clientHeight&&(rn(e,i.scroller.scrollTop),on(e,i.scroller.scrollLeft,!0),Pa(e,"scroll",e))}),Oa(i.scroller,"mousewheel",function(t){an(e,t)}),Oa(i.scroller,"DOMMouseScroll",function(t){an(e,t)}),Oa(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Si(e,t)||Ma(t)},over:function(t){Si(e,t)||(tn(e,t),Ma(t))},start:function(t){en(e,t)},drop:Nt(e,Jt),leave:function(){nn(e)}};var s=i.input.getField();Oa(s,"keyup",function(t){hn.call(e,t)}),Oa(s,"keydown",Nt(e,dn)),Oa(s,"keypress",Nt(e,mn)),Oa(s,"focus",Fi(vn,e)),Oa(s,"blur",Fi(yn,e))}function zt(t,n,r){var i=r&&r!=e.Init;if(!n!=!i){var o=t.display.dragFunctions,a=n?Oa:Aa;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function qt(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Vt(e,t){for(var n=wi(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Kt(e,t,n,r){var i=e.display;if(!n&&"true"==wi(t).getAttribute("cm-not-content"))return null;var o,a,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,a=t.clientY-s.top}catch(t){return null}var l,u=gt(e,o,a);if(r&&1==u.xRel&&(l=Qr(e.doc,u.line).text).length==u.ch){var c=Ba(l,l.length,e.options.tabSize)-l.length;u=jo(u.line,Math.max(0,Math.round((o-Ve(e.display).left)/bt(e.display))-c))}return u; }function $t(e){var t=this,n=t.display;if(!(Si(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.shift=e.shiftKey,Vt(n,e))return void(wo||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100)));if(!Zt(t,e)){var r=Kt(t,e);switch(window.focus(),Ci(e)){case 1:t.state.selectingText?t.state.selectingText(e):r?Gt(t,e,r):wi(e)==n.scroller&&Sa(e);break;case 2:wo&&(t.state.lastMiddleDown=+new Date),r&&xe(t.doc,r),setTimeout(function(){n.input.focus()},20),Sa(e);break;case 3:Do?bn(t,e):gn(t)}}}}function Gt(e,t,n){bo?setTimeout(Fi(X,e),0):e.curOp.focus=Vi();var r,i=+new Date;Wo&&Wo.time>i-400&&0==Fo(Wo.pos,n)?r="triple":Uo&&Uo.time>i-400&&0==Fo(Uo.pos,n)?(r="double",Wo={time:i,pos:n}):(r="single",Uo={time:i,pos:n});var o,a=e.doc.sel,s=No?t.metaKey:t.ctrlKey;e.options.dragDrop&&Ja&&!e.isReadOnly()&&"single"==r&&(o=a.contains(n))>-1&&(Fo((o=a.ranges[o]).from(),n)<0||n.xRel>0)&&(Fo(o.to(),n)>0||n.xRel<0)?Yt(e,t,n,s):Xt(e,t,n,r,s)}function Yt(e,t,n,r){var i=e.display,o=+new Date,a=Nt(e,function(s){wo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Aa(document,"mouseup",a),Aa(i.scroller,"drop",a),Math.abs(t.clientX-s.clientX)+Math.abs(t.clientY-s.clientY)<10&&(Sa(s),!r&&+new Date-200=h;h++){var v=Qr(u,h).text,y=Ha(v,l,o);l==p?i.push(new fe(jo(h,y),jo(h,y))):v.length>y&&i.push(new fe(jo(h,y),jo(h,Ha(v,p,o))))}i.length||i.push(new fe(n,n)),Se(u,de(d.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=c,x=b.anchor,w=t;if("single"!=r){if("double"==r)var C=e.findWordAt(t);else var C=new fe(jo(t.line,0),me(u,jo(t.line+1,0)));Fo(C.anchor,x)>0?(w=C.head,x=Y(b.from(),C.anchor)):(w=C.anchor,x=G(b.to(),C.head))}var i=d.ranges.slice(0);i[f]=new fe(me(u,x),w),Se(u,de(i,f),ja)}}function a(t){var n=++y,i=Kt(e,t,!0,"rect"==r);if(i)if(0!=Fo(i,g)){e.curOp.focus=Vi(),o(i);var s=x(l,u);(i.line>=s.to||i.linev.bottom?20:0;c&&setTimeout(Nt(e,function(){y==n&&(l.scroller.scrollTop+=c,a(t))}),50)}}function s(t){e.state.selectingText=!1,y=1/0,Sa(t),l.input.focus(),Aa(document,"mousemove",b),Aa(document,"mouseup",w),u.history.lastSelOrigin=null}var l=e.display,u=e.doc;Sa(t);var c,f,d=u.sel,p=d.ranges;if(i&&!t.shiftKey?(f=u.sel.contains(n),c=f>-1?p[f]:new fe(n,n)):(c=u.sel.primary(),f=u.sel.primIndex),t.altKey)r="rect",i||(c=new fe(n,n)),n=Kt(e,t,!0,!0),f=-1;else if("double"==r){var h=e.findWordAt(n);c=e.display.shift||u.extend?be(u,c,h.anchor,h.head):h}else if("triple"==r){var m=new fe(jo(n.line,0),me(u,jo(n.line+1,0)));c=e.display.shift||u.extend?be(u,c,m.anchor,m.head):m}else c=be(u,c,n);i?-1==f?(f=p.length,Se(u,de(p.concat([c]),f),{scroll:!1,origin:"*mouse"})):p.length>1&&p[f].empty()&&"single"==r&&!t.shiftKey?(Se(u,de(p.slice(0,f).concat(p.slice(f+1)),0),{scroll:!1,origin:"*mouse"}),d=u.sel):Ce(u,f,c,ja):(f=0,Se(u,new ce([c],0),ja),d=u.sel);var g=n,v=l.wrapper.getBoundingClientRect(),y=0,b=Nt(e,function(e){Ci(e)?a(e):s(e)}),w=Nt(e,s);e.state.selectingText=w,Oa(document,"mousemove",b),Oa(document,"mouseup",w)}function Qt(e,t,n,r){try{var i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Sa(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!Mi(e,n))return xi(t);o-=s.top-a.viewOffset;for(var l=0;l=i){var c=ni(e.doc,o),f=e.options.gutters[l];return Pa(e,n,e,c,f,t),xi(t)}}}function Zt(e,t){return Qt(e,t,"gutterClick",!0)}function Jt(e){var t=this;if(nn(t),!Si(t,e)&&!Vt(t.display,e)){Sa(e),bo&&(Ko=+new Date);var n=Kt(t,e,!0),r=e.dataTransfer.files;if(n&&!t.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),a=0,s=function(e,r){if(!t.options.allowDropFileTypes||-1!=Li(t.options.allowDropFileTypes,e.type)){var s=new FileReader;s.onload=Nt(t,function(){var e=s.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[r]=e,++a==i){n=me(t.doc,n);var l={from:n,to:n,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Sn(t.doc,l),Ee(t.doc,pe(n,Zo(l)))}}),s.readAsText(e)}},l=0;i>l;++l)s(r[l],l);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(No?e.altKey:e.ctrlKey))var u=t.listSelections();if(Te(t.doc,pe(n,n)),u)for(var l=0;la.clientWidth,l=a.scrollHeight>a.clientHeight;if(r&&s||i&&l){if(i&&No&&wo)e:for(var u=t.target,c=o.view;u!=a;u=u.parentNode)for(var f=0;fd?p=Math.max(0,p+d-50):h=Math.min(e.doc.height,h+d+50),O(e,{top:p,bottom:h})}20>$o&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,n=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,n&&(Go=(Go*$o+n)/($o+1),++$o)}},200)):(o.wheelDX+=r,o.wheelDY+=i))}}function sn(e,t,n){if("string"==typeof t&&(t=ua[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ra}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function ln(e,t,n){for(var r=0;rxo&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var r=cn(t,e);ko&&(Qo=r?n:null,!r&&88==n&&!ns&&(No?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||pn(t)}}function pn(e){function t(e){18!=e.keyCode&&e.altKey||(Xa(n,"CodeMirror-crosshair"),Aa(document,"keyup",t),Aa(document,"mouseover",t))}var n=e.display.lineDiv;Qa(n,"CodeMirror-crosshair"),Oa(document,"keyup",t),Oa(document,"mouseover",t)}function hn(e){16==e.keyCode&&(this.doc.sel.shift=!1),Si(this,e)}function mn(e){var t=this;if(!(Vt(t.display,e)||Si(t,e)||e.ctrlKey&&!e.altKey||No&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(ko&&n==Qo)return Qo=null,void Sa(e);if(!ko||e.which&&!(e.which<10)||!cn(t,e)){var i=String.fromCharCode(null==r?n:r);fn(t,e,i)||t.display.input.onKeyPress(e)}}}function gn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,yn(e))},100)}function vn(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Pa(e,"focus",e),e.state.focused=!0,Qa(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),wo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Fe(e))}function yn(e){e.state.delayingBlurEvent||(e.state.focused&&(Pa(e,"blur",e),e.state.focused=!1,Xa(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function bn(e,t){Vt(e.display,t)||xn(e,t)||Si(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function xn(e,t){return Mi(e,"gutterContextMenu")?Qt(e,t,"gutterContextMenu",!1):!1}function wn(e,t){if(Fo(e,t.from)<0)return e;if(Fo(e,t.to)<=0)return Zo(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+=Zo(t).ch-t.to.ch),jo(n,r)}function Cn(e,t){for(var n=[],r=0;r=0;--i)Tn(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else Tn(e,t)}}function Tn(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Fo(t.from,t.to)){var n=Cn(e,t);ui(e,t,n,e.cm?e.cm.curOp.id:NaN),Nn(e,t,n,or(e,t));var r=[];Yr(e,function(e,n){n||-1!=Li(r,e.history)||(bi(e.history,t),r.push(e.history)),Nn(e,t,null,or(e,t))})}}function Mn(e,t,n){if(!e.cm||!e.cm.state.suppressEdits){for(var r,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,l=0;l=0;--l){var f=r.changes[l];if(f.origin=t,c&&!En(e,f,!1))return void(a.length=0);u.push(ai(e,f));var d=l?Cn(e,f):Pi(a);Nn(e,f,d,sr(e,f)),!l&&e.cm&&e.cm.scrollIntoView({from:f.from,to:Zo(f)});var p=[];Yr(e,function(e,t){t||-1!=Li(p,e.history)||(bi(e.history,f),p.push(e.history)),Nn(e,f,null,sr(e,f))})}}}}function On(e,t){if(0!=t&&(e.first+=t,e.sel=new ce(Di(e.sel.ranges,function(e){return new fe(jo(e.anchor.line+t,e.anchor.ch),jo(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Rt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:jo(o,Qr(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Zr(e,t.from,t.to),n||(n=Cn(e,t)),e.cm?An(e.cm,t,r):Kr(e,t,r),Te(e,n,Ia)}}function An(e,t,n){var r=e.doc,i=e.display,a=t.from,s=t.to,l=!1,u=a.line;e.options.lineWrapping||(u=ti(yr(Qr(r,a.line))),r.iter(u,s.line+1,function(e){return e==i.maxLine?(l=!0,!0):void 0})),r.sel.contains(t.from,t.to)>-1&&Ti(e),Kr(r,t,n,o(e)),e.options.lineWrapping||(r.iter(u,a.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,a.line),Be(e,400);var c=t.text.length-(s.line-a.line)-1;t.full?Rt(e):a.line!=s.line||1!=t.text.length||Vr(e.doc,t)?Rt(e,a.line,s.line+1,c):It(e,a.line,"text");var d=Mi(e,"changes"),p=Mi(e,"change");if(p||d){var h={from:a,to:s,text:t.text,removed:t.removed,origin:t.origin};p&&ki(e,"change",e,h),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function Pn(e,t,n,r,i){if(r||(r=n),Fo(r,n)<0){var o=r;r=n,n=o}"string"==typeof t&&(t=e.splitLines(t)),Sn(e,{from:n,to:r,text:t,origin:i})}function Ln(e,t){if(!Si(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!To){var o=Wi("div","​",null,"position: absolute; top: "+(t.top-n.viewOffset-ze(e.display))+"px; height: "+(t.bottom-t.top+Ke(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Dn(e,t,n,r){null==r&&(r=0);for(var i=0;5>i;i++){var o=!1,a=pt(e,t),s=n&&n!=t?pt(e,n):a,l=In(e,Math.min(a.left,s.left),Math.min(a.top,s.top)-r,Math.max(a.left,s.left),Math.max(a.bottom,s.bottom)+r),u=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=l.scrollTop&&(rn(e,l.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(o=!0)),null!=l.scrollLeft&&(on(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-c)>1&&(o=!0)),!o)break}return a}function Rn(e,t,n,r,i){var o=In(e,t,n,r,i);null!=o.scrollTop&&rn(e,o.scrollTop),null!=o.scrollLeft&&on(e,o.scrollLeft)}function In(e,t,n,r,i){var o=e.display,a=yt(e.display);0>n&&(n=0);var s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,l=Ge(e),u={};i-n>l&&(i=n+l);var c=e.doc.height+qe(o),f=a>n,d=i>c-a;if(s>n)u.scrollTop=f?0:n;else if(i>s+l){var p=Math.min(n,(d?c:i)-l);p!=s&&(u.scrollTop=p)}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=$e(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=r-t>m;return g&&(r=t+m),10>t?u.scrollLeft=0:h>t?u.scrollLeft=Math.max(0,t-(g?0:10)):r>m+h-3&&(u.scrollLeft=r+(g?0:10)-m),u}function jn(e,t,n){(null!=t||null!=n)&&Bn(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=n&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+n)}function Fn(e){Bn(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?jo(t.line,t.ch-1):t,r=jo(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function Bn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ht(e,t.from),r=ht(e,t.to),i=In(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 Hn(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=We(e,t):n="prev");var a=e.options.tabSize,s=Qr(o,t),l=Ba(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&(u=o.mode.indent(i,s.text.slice(c.length),s.text),u==Ra||u>150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?Ba(Qr(o,t-1).text,null,a):0:"add"==n?u=l+e.options.indentUnit:"subtract"==n?u=l-e.options.indentUnit:"number"==typeof n&&(u=l+n),u=Math.max(0,u);var f="",d=0;if(e.options.indentWithTabs)for(var p=Math.floor(u/a);p;--p)d+=a,f+=" ";if(u>d&&(f+=Ai(u-d)),f!=c)return Pn(o,f,jo(t,0),jo(t,c.length),"+input"),s.stateAfter=null,!0;for(var p=0;p=0;t--)Pn(e.doc,"",r[t].from,r[t].to,"+delete");Fn(e)})}function zn(e,t,n,r,i){function o(){var t=s+n;return t=e.first+e.size?!1:(s=t,c=Qr(e,t))}function a(e){var t=(i?fo:po)(c,l,n,!0);if(null==t){if(e||!o())return!1;l=i?(0>n?io:ro)(c):0>n?c.text.length:0}else l=t;return!0}var s=t.line,l=t.ch,u=n,c=Qr(e,s);if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var f=null,d="group"==r,p=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(0>n)||a(!h);h=!1){var m=c.text.charAt(l)||"\n",g=Bi(m,p)?"w":d&&"\n"==m?"n":!d||/\s/.test(m)?null:"p";if(!d||h||g||(g="s"),f&&f!=g){0>n&&(n=1,a());break}if(g&&(f=g),n>0&&!a(!h))break}var v=Pe(e,jo(s,l),t,u,!0);return Fo(t,v)||(v.hitSide=!0),v}function qn(e,t,n,r){var i,o=e.doc,a=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+n*(s-(0>n?1.5:.5)*yt(e.display))}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){var l=gt(e,a,i);if(!l.outside)break;if(0>n?0>=i:i>=o.height){l.hitSide=!0;break}i+=5*n}return l}function Vn(t,n,r,i){e.defaults[t]=n,r&&(ea[t]=i?function(e,t,n){n!=ta&&r(e,t,n)}:r)}function Kn(e){for(var t,n,r,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Wi("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(vr(e,t.line,t,n,o)||t.line!=n.line&&vr(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Io=!0}o.addToHistory&&ui(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var s,l=t.line,u=e.cm;if(e.iter(l,n.line+1,function(e){u&&o.collapsed&&!u.options.lineWrapping&&yr(e)==u.display.maxLine&&(s=!0),o.collapsed&&l!=t.line&&ei(e,0),nr(e,new Jn(o,l==t.line?t.ch:null,l==n.line?n.ch:null)),++l}),o.collapsed&&e.iter(t.line,n.line+1,function(t){Cr(e,t)&&ei(t,0)}),o.clearOnEnter&&Oa(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Ro=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ma,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)Rt(u,t.line,n.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=t.line;c<=n.line;c++)It(u,c,"text");o.atomic&&Oe(u.doc),ki(u,"markerAdded",u,o)}return o}function Yn(e,t,n,r,i){r=ji(r),r.shared=!1;var o=[Gn(e,t,n,r,i)],a=o[0],s=r.widgetNode;return Yr(e,function(e){s&&(r.widgetNode=s.cloneNode(!0)),o.push(Gn(e,me(e,t),me(e,n),r,i));for(var l=0;l=t:o.to>t);(r||(r=[])).push(new Jn(a,o.from,l?null:o.to))}}return r}function ir(e,t,n){if(e)for(var r,i=0;i=t:o.to>t);if(s||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&s)for(var f=0;ff;++f)h.push(m);h.push(l)}return h}function ar(e){for(var t=0;t0)){var c=[l,1],f=Fo(u.from,s.from),d=Fo(u.to,s.to);(0>f||!a.inclusiveLeft&&!f)&&c.push({from:u.from,to:s.from}),(d>0||!a.inclusiveRight&&!d)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),l+=c.length-1}}return i}function ur(e){var t=e.markedSpans;if(t){for(var n=0;n=0&&0>=f||0>=c&&f>=0)&&(0>=c&&(Fo(u.to,n)>0||l.marker.inclusiveRight&&i.inclusiveLeft)||c>=0&&(Fo(u.from,r)<0||l.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function yr(e){for(var t;t=mr(e);)e=t.find(-1,!0).line;return e}function br(e){for(var t,n;t=gr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function xr(e,t){var n=Qr(e,t),r=yr(n);return n==r?t:ti(r)}function wr(e,t){if(t>e.lastLine())return t;var n,r=Qr(e,t);if(!Cr(e,r))return t;for(;n=gr(r);)r=n.find(1,!0).line;return ti(r)+1}function Cr(e,t){var n=Io&&t.markedSpans;if(n)for(var r,i=0;io;o++){i&&(i[0]=e.innerMode(t,r).mode);var a=t.token(n,r);if(n.pos>n.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function Pr(e,t,n,r){function i(e){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:e?sa(a.mode,c):c}}var o,a=e.doc,s=a.mode;t=me(a,t);var l,u=Qr(a,t.line),c=We(e,t.line,n),f=new ha(u.text,e.options.tabSize);for(r&&(l=[]);(r||f.pose.options.maxHighlightLength?(s=!1,a&&Ir(e,t,r,f.pos),f.pos=t.length,l=null):l=Or(Ar(n,f,r,d),o),d){var p=d[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!s||c!=l){for(;uu;){var r=i[l];r>e&&i.splice(l,1,e,i[l+1],r),l+=2,u=Math.min(e,r)}if(t)if(s.opaque)i.splice(n,l-n,e,"cm-overlay "+t),l=n+2;else for(;l>n;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Rr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=We(e,ti(t)),i=Dr(e,t,t.text.length>e.options.maxHighlightLength?sa(e.doc.mode,r):r);t.stateAfter=r,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++}return t.styles}function Ir(e,t,n,r){var i=e.doc.mode,o=new ha(t,e.options.tabSize);for(o.start=o.pos=r||0,""==t&&Nr(i,n);!o.eol();)Ar(i,o,n),o.start=o.pos}function jr(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?wa:xa;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Fr(e,t){var n=Wi("span",null,null,wo?"padding-right: .1px":null),r={pre:Wi("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,splitSpaces:(bo||wo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;r.pos=0,r.addToken=Hr,Zi(e.display.measure)&&(o=ii(a))&&(r.addToken=Wr(r.addToken,o)),r.map=[];var s=t!=e.display.externalMeasured&&ti(a);qr(a,r,Rr(e,a,s)),a.styleClasses&&(a.styleClasses.bgClass&&(r.bgClass=$i(a.styleClasses.bgClass,r.bgClass||"")),a.styleClasses.textClass&&(r.textClass=$i(a.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Qi(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return wo&&/\bcm-tab\b/.test(r.content.lastChild.className)&&(r.content.className="cm-tab-wrap-hack"),Pa(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=$i(r.pre.className,r.textClass||"")),r}function Br(e){var t=Wi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Hr(e,t,n,r,i,o,a){if(t){var s=e.splitSpaces?t.replace(/ {3,}/g,Ur):t,l=e.cm.state.specialChars,u=!1;if(l.test(t))for(var c=document.createDocumentFragment(),f=0;;){l.lastIndex=f;var d=l.exec(t),p=d?d.index-f:t.length-f;if(p){var h=document.createTextNode(s.slice(f,f+p));bo&&9>xo?c.appendChild(Wi("span",[h])):c.appendChild(h),e.map.push(e.pos,e.pos+p,h),e.col+=p,e.pos+=p}if(!d)break; if(f+=p+1," "==d[0]){var m=e.cm.options.tabSize,g=m-e.col%m,h=c.appendChild(Wi("span",Ai(g),"cm-tab"));h.setAttribute("role","presentation"),h.setAttribute("cm-text"," "),e.col+=g}else if("\r"==d[0]||"\n"==d[0]){var h=c.appendChild(Wi("span","\r"==d[0]?"␍":"␤","cm-invalidchar"));h.setAttribute("cm-text",d[0]),e.col+=1}else{var h=e.cm.options.specialCharPlaceholder(d[0]);h.setAttribute("cm-text",d[0]),bo&&9>xo?c.appendChild(Wi("span",[h])):c.appendChild(h),e.col+=1}e.map.push(e.pos,e.pos+1,h),e.pos++}else{e.col+=t.length;var c=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,c),bo&&9>xo&&(u=!0),e.pos+=t.length}if(n||r||i||u||a){var v=n||"";r&&(v+=r),i&&(v+=i);var y=Wi("span",[c],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(c)}}function Ur(e){for(var t=" ",n=0;nu&&d.from<=u)break}if(d.to>=c)return e(n,r,i,o,a,s,l);e(n,r.slice(0,d.to-u),i,o,null,s,l),o=null,r=r.slice(d.to-u),u=d.to}}}function zr(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function qr(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,s,l,u,c,f,d,p=i.length,h=0,m=1,g="",v=0;;){if(v==h){l=u=c=f=s="",d=null,v=1/0;for(var y,b=[],x=0;xh||C.collapsed&&w.to==h&&w.from==h)?(null!=w.to&&w.to!=h&&v>w.to&&(v=w.to,u=""),C.className&&(l+=" "+C.className),C.css&&(s=(s?s+";":"")+C.css),C.startStyle&&w.from==h&&(c+=" "+C.startStyle),C.endStyle&&w.to==v&&(y||(y=[])).push(C.endStyle,w.to),C.title&&!f&&(f=C.title),C.collapsed&&(!d||pr(d.marker,C)<0)&&(d=w)):w.from>h&&v>w.from&&(v=w.from)}if(y)for(var x=0;x=p)break;for(var _=Math.min(p,v);;){if(g){var k=h+g.length;if(!d){var E=k>_?g.slice(0,_-h):g;t.addToken(t,E,a?a+l:l,c,h+E.length==v?u:"",f,s)}if(k>=_){g=g.slice(_-h),h=_;break}h=k,c=""}g=i.slice(o,o=n[m++]),a=jr(n[m++],t.cm.options)}}else for(var m=1;mn;++n)o.push(new ba(u[n],i(n),r));return o}var s=t.from,l=t.to,u=t.text,c=Qr(e,s.line),f=Qr(e,l.line),d=Pi(u),p=i(u.length-1),h=l.line-s.line;if(t.full)e.insert(0,a(0,u.length)),e.remove(u.length,e.size-u.length);else if(Vr(e,t)){var m=a(0,u.length-1);o(f,f.text,p),h&&e.remove(s.line,h),m.length&&e.insert(s.line,m)}else if(c==f)if(1==u.length)o(c,c.text.slice(0,s.ch)+d+c.text.slice(l.ch),p);else{var m=a(1,u.length-1);m.push(new ba(d+c.text.slice(l.ch),p,r)),o(c,c.text.slice(0,s.ch)+u[0],i(0)),e.insert(s.line+1,m)}else if(1==u.length)o(c,c.text.slice(0,s.ch)+u[0]+f.text.slice(l.ch),i(0)),e.remove(s.line+1,h);else{o(c,c.text.slice(0,s.ch)+u[0],i(0)),o(f,d+f.text.slice(l.ch),p);var m=a(1,u.length-1);h>1&&e.remove(s.line+1,h-1),e.insert(s.line+1,m)}ki(e,"change",e,t)}function $r(e){this.lines=e,this.parent=null;for(var t=0,n=0;tt||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],o=i.chunkSize();if(o>t){n=i;break}t-=o}return n.lines[t]}function Zr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function Jr(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function ei(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function ti(e){if(null==e.parent)return null;for(var t=e.parent,n=Li(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function ni(e,t){var n=e.first;e:do{for(var r=0;rt){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var r=0;rt)break;t-=s}return n+r}function ri(e){e=yr(e);for(var t=0,n=e.parent,r=0;r1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Pi(e.done)):void 0}function ui(e,t,n,r){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=li(i,i.lastOp==r))){var s=Pi(o.changes);0==Fo(t.from,t.to)&&0==Fo(t.from,s.to)?s.to=Zo(t):o.changes.push(ai(e,t))}else{var l=Pi(i.done);for(l&&l.ranges||di(e.sel,i.done),o={changes:[ai(e,t)],generation:i.generation},i.done.push(o);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=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,s||Pa(e,"historyAdded")}function ci(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 fi(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||ci(e,o,Pi(i.done),t))?i.done[i.done.length-1]=t:di(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&si(i.undone)}function di(e,t){var n=Pi(t);n&&n.ranges&&n.equals(e)||t.push(e)}function pi(e,t,n,r){var i=t["spans_"+e.id],o=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]={}))[o]=n.markedSpans),++o})}function hi(e){if(!e)return null;for(var t,n=0;n-1&&(Pi(s)[f]=c[f],delete c[f])}}}return i}function vi(e,t,n,r){n0?r.slice():Na:r||Na}function ki(e,t){function n(e){return function(){e.apply(null,o)}}var r=_i(e,t,!1);if(r.length){var i,o=Array.prototype.slice.call(arguments,2);qo?i=qo.delayedCallbacks:La?i=La:(i=La=[],setTimeout(Ei,0));for(var a=0;a0}function Oi(e){e.prototype.on=function(e,t){Oa(this,e,t)},e.prototype.off=function(e,t){Aa(this,e,t)}}function Ni(){this.id=null}function Ai(e){for(;Ua.length<=e;)Ua.push(Pi(Ua)+" ");return Ua[e]}function Pi(e){return e[e.length-1]}function Li(e,t){for(var n=0;n-1&&Va(e)?!0:t.test(e):Va(e)}function Hi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Ui(e){return e.charCodeAt(0)>=768&&Ka.test(e)}function Wi(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o0;--t)e.removeChild(e.firstChild);return e}function qi(e,t){return zi(e).appendChild(t)}function Vi(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function Ki(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function $i(e,t){for(var n=e.split(" "),r=0;r2&&!(bo&&8>xo))}var n=Ga?Wi("span","​"):Wi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Zi(e){if(null!=Ya)return Ya;var t=qi(e,document.createTextNode("AخA")),n=za(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=za(t,1,2).getBoundingClientRect();return Ya=r.right-n.right<3}function Ji(e){if(null!=rs)return rs;var t=qi(e,Wi("span","x")),n=t.getBoundingClientRect(),r=za(t,0,1).getBoundingClientRect();return rs=Math.abs(n.left-r.left)>1}function eo(e,t,n,r){if(!e)return r(t,n,"ltr");for(var i=!1,o=0;ot||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr"),i=!0)}i||r(t,n,"ltr")}function to(e){return e.level%2?e.to:e.from}function no(e){return e.level%2?e.from:e.to}function ro(e){var t=ii(e);return t?to(t[0]):0}function io(e){var t=ii(e);return t?no(Pi(t)):e.text.length}function oo(e,t){var n=Qr(e.doc,t),r=yr(n);r!=n&&(t=ti(r));var i=ii(r),o=i?i[0].level%2?io(r):ro(r):0;return jo(t,o)}function ao(e,t){for(var n,r=Qr(e.doc,t);n=gr(r);)r=n.find(1,!0).line,t=null;var i=ii(r),o=i?i[0].level%2?ro(r):io(r):r.text.length;return jo(null==t?ti(r):t,o)}function so(e,t){var n=oo(e,t.line),r=Qr(e.doc,n.line),i=ii(r);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return jo(n.line,a?0:o)}return n}function lo(e,t,n){var r=e[0].level;return t==r?!0:n==r?!1:n>t}function uo(e,t){os=null;for(var n,r=0;rt)return r;if(i.from==t||i.to==t){if(null!=n)return lo(e,i.level,e[n].level)?(i.from!=i.to&&(os=n),r):(i.from!=i.to&&(os=r),n);n=r}}return n}function co(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&Ui(e.text.charAt(t)));return t}function fo(e,t,n,r){var i=ii(e);if(!i)return po(e,t,n,r);for(var o=uo(i,t),a=i[o],s=co(e,t,a.level%2?-n:n,r);;){if(s>a.from&&s0==a.level%2?a.to:a.from);if(a=i[o+=n],!a)return null;s=n>0==a.level%2?co(e,a.to,-1,r):co(e,a.from,1,r)}}function po(e,t,n,r){var i=t+n;if(r)for(;i>0&&Ui(e.text.charAt(i));)i+=n;return 0>i||i>e.text.length?null:i}var ho=navigator.userAgent,mo=navigator.platform,go=/gecko\/\d/i.test(ho),vo=/MSIE \d/.test(ho),yo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ho),bo=vo||yo,xo=bo&&(vo?document.documentMode||6:yo[1]),wo=/WebKit\//.test(ho),Co=wo&&/Qt\/\d+\.\d+/.test(ho),_o=/Chrome\//.test(ho),ko=/Opera\//.test(ho),Eo=/Apple Computer/.test(navigator.vendor),So=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ho),To=/PhantomJS/.test(ho),Mo=/AppleWebKit/.test(ho)&&/Mobile\/\w+/.test(ho),Oo=Mo||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ho),No=Mo||/Mac/.test(mo),Ao=/win/i.test(mo),Po=ko&&ho.match(/Version\/(\d*\.\d*)/);Po&&(Po=Number(Po[1])),Po&&Po>=15&&(ko=!1,wo=!0);var Lo=No&&(Co||ko&&(null==Po||12.11>Po)),Do=go||bo&&xo>=9,Ro=!1,Io=!1;m.prototype=ji({update:function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var e=No&&!So?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Ni,this.disableVert=new Ni},enableZeroWidthBar:function(e,t){function n(){var r=e.getBoundingClientRect(),i=document.elementFromPoint(r.left+1,r.bottom-1);i!=e?e.style.pointerEvents="none":t.set(1e3,n)}e.style.pointerEvents="auto",t.set(1e3,n)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=ji({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={"native":m,"null":g},E.prototype.signal=function(e,t){Mi(e,t)&&this.events.push(arguments)},E.prototype.finish=function(){for(var e=0;e=9&&n.hasSelection&&(n.hasSelection=null),n.poll()}),Oa(o,"paste",function(e){Si(r,e)||Z(e,r)||(r.state.pasteIncoming=!0,n.fastPoll())}),Oa(o,"cut",t),Oa(o,"copy",t),Oa(e.scroller,"paste",function(t){Vt(e,t)||Si(r,t)||(r.state.pasteIncoming=!0,n.focus())}),Oa(e.lineSpace,"selectstart",function(t){Vt(e,t)||Sa(t)}),Oa(o,"compositionstart",function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Oa(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,n=e.doc,r=Re(e);if(e.options.moveInputWithCursor){var i=pt(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},showSelection:function(e){var t=this.cm,n=t.display;qi(n.cursorDiv,e.cursors),qi(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,n,r=this.cm,i=r.doc;if(r.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=ns&&(o.to().line-o.from().line>100||(n=r.getSelection()).length>1e3);var a=t?"-":n||r.getSelection();this.textarea.value=a,r.state.focused&&Wa(this.textarea),bo&&xo>=9&&(this.hasSelection=a)}else e||(this.prevInput=this.textarea.value="",bo&&xo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Oo||Vi()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))}var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,n=this.prevInput;if(this.contextMenuPending||!e.state.focused||ts(t)&&!n&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=t.value;if(r==n&&!e.somethingSelected())return!1;if(bo&&xo>=9&&this.hasSelection===r||No&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=r.charCodeAt(0);if(8203!=i||n||(n="​"),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(n.length,r.length);a>o&&n.charCodeAt(o)==r.charCodeAt(o);)++o;var s=this;return Ot(e,function(){Q(e,r.slice(o),n.length-o,null,s.composing?"*compose":null),r.length>1e3||r.indexOf("\n")>-1?t.value=s.prevInput="":s.prevInput=r,s.composing&&(s.composing.range.clear(),s.composing.range=e.markText(s.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){bo&&xo>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t="​"+(e?a.value:"");a.value="⇚",a.value=t,r.prevInput=e?"":"​",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function n(){if(r.contextMenuPending=!1,r.wrapper.style.position="relative",a.style.cssText=c,bo&&9>xo&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=a.selectionStart){(!bo||bo&&9>xo)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==r.prevInput?Nt(i,ua.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(n,500):o.input.reset()};o.detectingSelectAll=setTimeout(n,200)}}var r=this,i=r.cm,o=i.display,a=r.textarea,s=Kt(i,e),l=o.scroller.scrollTop;if(s&&!ko){var u=i.options.resetSelectionOnContextMenu;u&&-1==i.doc.sel.contains(s)&&Nt(i,Se)(i.doc,pe(s),Ia);var c=a.style.cssText;if(r.wrapper.style.position="absolute",a.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(bo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",wo)var f=window.scrollY;if(o.input.focus(),wo&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(a.value=r.prevInput=" "),r.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),bo&&xo>=9&&t(),Do){Ma(e);var d=function(){Aa(window,"mouseup",d),setTimeout(n,20)};Oa(window,"mouseup",d)}else setTimeout(n,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Ri,needsContentAttribute:!1},ne.prototype),ie.prototype=ji({init:function(e){function t(e){if(!Si(r,e)){if(r.somethingSelected())Bo=r.getSelections(),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=ee(r);Bo=t.text,"cut"==e.type&&r.operation(function(){r.setSelections(t.ranges,0,Ia),r.replaceSelection("",null,"cut")})}if(e.clipboardData&&!Mo)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Bo.join("\n"));else{var n=re(),i=n.firstChild;r.display.lineSpace.insertBefore(n,r.display.lineSpace.firstChild),i.value=Bo.join("\n");var o=document.activeElement;Wa(i),setTimeout(function(){r.display.lineSpace.removeChild(n),o.focus()},50)}}}var n=this,r=n.cm,i=n.div=e.lineDiv;te(i),Oa(i,"paste",function(e){Si(r,e)||Z(e,r)}),Oa(i,"compositionstart",function(e){var t=e.data;if(n.composing={sel:r.doc.sel,data:t,startData:t},t){var i=r.doc.sel.primary(),o=r.getLine(i.head.line),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(n.composing.sel=pe(jo(i.head.line,a),jo(i.head.line,a+t.length)))}}),Oa(i,"compositionupdate",function(e){n.composing.data=e.data}),Oa(i,"compositionend",function(e){var t=n.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||n.applyComposition(t),n.composing==t&&(n.composing=null)},50))}),Oa(i,"touchstart",function(){n.forceCompositionEnd()}),Oa(i,"input",function(){n.composing||(r.isReadOnly()||!n.pollContent())&&Ot(n.cm,function(){Rt(r)})}),Oa(i,"copy",t),Oa(i,"cut",t)},prepareSelection:function(){var e=Re(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),n=se(this.cm,e.anchorNode,e.anchorOffset),r=se(this.cm,e.focusNode,e.focusOffset);if(!n||n.bad||!r||r.bad||0!=Fo(Y(n,r),t.from())||0!=Fo(G(n,r),t.to())){var i=oe(this.cm,t.from()),o=oe(this.cm,t.to());if(i||o){var a=this.cm.display.view,s=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var l=a[a.length-1].measure,u=l.maps?l.maps[l.maps.length-1]:l.map;o={node:u[u.length-1],offset:u[u.length-2]-u[u.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var c=za(i.node,i.offset,o.offset,o.node)}catch(f){}c&&(!go&&this.cm.state.focused?(e.collapse(i.node,i.offset),c.collapsed||e.addRange(c)):(e.removeAllRanges(),e.addRange(c)),s&&null==e.anchorNode?e.addRange(s):go&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){qi(this.cm.display.cursorDiv,e.cursors),qi(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return $a(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Ot(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var n=se(t,e.anchorNode,e.anchorOffset),r=se(t,e.focusNode,e.focusOffset);n&&r&&Ot(t,function(){Se(t.doc,pe(n,r),Ia),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.linet.viewTo-1)return!1;var o;if(r.line==t.viewFrom||0==(o=Ft(e,r.line)))var a=ti(t.view[0].line),s=t.view[0].node;else var a=ti(t.view[o].line),s=t.view[o-1].node.nextSibling;var l=Ft(e,i.line);if(l==t.view.length-1)var u=t.viewTo-1,c=t.lineDiv.lastChild;else var u=ti(t.view[l+1].line)-1,c=t.view[l+1].node.previousSibling;for(var f=e.doc.splitLines(ue(e,s,c,a,u)),d=Zr(e.doc,jo(a,0),jo(u,Qr(e.doc,u).text.length));f.length>1&&d.length>1;)if(Pi(f)==Pi(d))f.pop(),d.pop(),u--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),a++}for(var p=0,h=0,m=f[0],g=d[0],v=Math.min(m.length,g.length);v>p&&m.charCodeAt(p)==g.charCodeAt(p);)++p;for(var y=Pi(f),b=Pi(d),x=Math.min(y.length-(1==f.length?p:0),b.length-(1==d.length?p:0));x>h&&y.charCodeAt(y.length-h-1)==b.charCodeAt(b.length-h-1);)++h;f[f.length-1]=y.slice(0,y.length-h),f[0]=f[0].slice(p);var w=jo(a,p),C=jo(u,d.length?Pi(d).length-h:0);return f.length>1||f[0]||Fo(w,C)?(Pn(e.doc,f,w,C,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){this.cm.isReadOnly()?Nt(this.cm,Rt)(this.cm):e.data&&e.data!=e.startData&&Nt(this.cm,Q)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),this.cm.isReadOnly()||Nt(this.cm,Q)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Ri,resetPosition:Ri,needsContentAttribute:!0},ie.prototype),e.inputStyles={textarea:ne,contenteditable:ie},ce.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=0&&Fo(e,r.to())<=0)return n}return-1}},fe.prototype={from:function(){return Y(this.anchor,this.head)},to:function(){return G(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Ho,Uo,Wo,zo={left:0,right:0,top:0,bottom:0},qo=null,Vo=0,Ko=0,$o=0,Go=null;bo?Go=-.53:go?Go=15:_o?Go=-.7:Eo&&(Go=-1/3);var Yo=function(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}};e.wheelEventPixels=function(e){var t=Yo(e);return t.x*=Go,t.y*=Go,t};var Xo=new Ni,Qo=null,Zo=e.changeEnd=function(e){return e.text?jo(e.from.line+e.text.length-1,Pi(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];(n[e]!=t||"mode"==e)&&(n[e]=t,ea.hasOwnProperty(e)&&Nt(this,ea[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"]($n(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(Hn(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Fn(this));else{var o=i.from(),a=i.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;n>l;++l)Hn(this,l,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[r].from().ch>0&&Ce(this.doc,r,new fe(o,u[r].to()),Ia)}}}),getTokenAt:function(e,t){return Pr(this,e,t)},getLineTokens:function(e,t){return Pr(this,jo(e),t,!0)},getTokenTypeAt:function(e){e=me(this.doc,e);var t,n=Rr(this,Qr(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch; diff --git a/src/index.js b/src/index.js index fea940b9..1aa6957e 100644 --- a/src/index.js +++ b/src/index.js @@ -43,7 +43,7 @@ function requireAuth(nextState, replace) { render(( - +